Add HTML Snippet only on specific pages

You can try using the wp_head hook like this and checking if it’s a post or page you want it to load on with an if statement: function wse_add_snippet_to_header() { //replace the array with your own post ids that you want this on //replace is_single with is_page if you want to check for pages instead … Read more

WordPress Wysiwyg Content not being displayed

To expand on what @fischi said, first step to troubleshooting is switch to the default theme (twentyeleven) and disable all plugins. If your content shows up, turn plugins back on one by one until you either find the offending plugin or they’re all on. If you get them all back on and the content still … Read more

Add a css class to a taxonomy permalink

The filter you are looking for is term_links-$taxonomy, where $taxonomy is the taxonomy name. This will filter the $term_links links array before outputting by the_terms(): add_filter(‘term_links-cities’, ‘ad_filter_links’); function ad_filter_links($term_links) { foreach ($term_links as $term_link) { $term_link = str_replace(‘<a ‘, ‘<a class=”fancybox”‘, $term_link); } return $term_links; }

Add HTML to single post tag

I found the best solution was to add a custom field, head, and then build a short plugin to add the contents to the head tag: add_action(‘wp_head’, ‘add_HTML_head’); function add_HTML_head(){ global $post; if(!empty($post)){ // get custom field for ‘head’ $headHTML = get_post_meta($post->ID, ‘head’, true); if(!empty($headHTML)){ echo $headHTML; } } } I’ve packaged it up into … Read more

Add custom HTML to posts page

If you want to modify the main <header> output take a look at header.php. This file will be called before the other templates. If you want to modify the template that is used to display your latest blog posts, index.php would be the file of choice. Index.php is also the fallback template for any post … Read more

Content editor creating blank paragraphs in spaces and creating &nbsp in the_excerpt

Judging from your site’s content and the comments, you may try using the following CODE in your theme’s functions.php file. It’ll remove empty <p>&nbsp;</p> tags from post content: add_filter( ‘the_content’, ‘wpse_257854_remove_empty_p’, PHP_INT_MAX ); add_filter( ‘the_excerpt’, ‘wpse_257854_remove_empty_p’, PHP_INT_MAX ); function wpse_257854_remove_empty_p( $content ) { return str_ireplace( ‘<p>&nbsp;</p>’, ”, $content ); } However, after it removes the … Read more

Is it ok to replace php code with html?

Quite strange that the core developers would decide to make an URL translatable, it is actually a case here of over-doing something. But anyways, lets get to the main question PHP vs HTML Although there are many reasons I can think of why one would prefer PHP above HTML, and that goes for the core … Read more