remove empty paragraphs from the_content?

WordPress will automatically insert <p> and </p> tags which separate content breaks within a post or page. If, for some reason, you want or need to remove these, you can use either of the following code snippets. To completely disable the wpautop filter, you can use: remove_filter(‘the_content’, ‘wpautop’); If you still want this to function … Read more

How to customize the_archive_title()?

If you look at the source code of get_the_archive_title(), you will see that there is a filter supplied, called get_the_archive_title, through which you can filter the output from the function. You can use the following to change the output on a category page add_filter( ‘get_the_archive_title’, function ( $title ) { if( is_category() ) { $title … Read more

get_template_directory_uri pointing to parent theme not child theme

get_template_directory_uri() will always return the URI of the current parent theme. To get the child theme URI instead, you need to use get_stylesheet_directory_uri(). You can find these in the documentation, along with a list of other useful functions for getting various theme directory locations. If you prefer to use a constant, then TEMPLATEPATH is akin … Read more

Remove “Category:”, “Tag:”, “Author:” from the_archive_title

You can extend the get_the_archive_title filter which I’ve mentioned in this answer add_filter(‘get_the_archive_title’, function ($title) { if (is_category()) { $title = single_cat_title(”, false); } elseif (is_tag()) { $title = single_tag_title(”, false); } elseif (is_author()) { $title=”<span class=”vcard”>” . get_the_author() . ‘</span>’; } elseif (is_tax()) { //for custom post types $title = sprintf(__(‘%1$s’), single_term_title(”, false)); } … Read more