When a link doesn’t exist, how to tell WordPress what to do? (404 Error Page)

The conditional you use to output get_template_part(‘content’, ‘none’); is only triggered if there is no post in the main loop, for example, when a category has no posts in it: if (have_posts()){ while(have_posts()) { the_post(); // If the category has a post and we are on a category page, then show the posts get_template_part(‘content’, ‘archive’); … Read more

How to get the HTML until ?

Front end styling is usually a theme territory that plugins should avoid. There is no simple way to know how anything is styled without actually doing the full styling, as some of it will depend on the content itself, and since the styling is basically random from the plugin author POV, you are unlikely to … Read more

An unwanted inline style is added to my body tag

After searching a lot, I realized that elements inside my head tag are shown inside body tag and head tag contains nothing in my generated HTML code. This happened because I had used UTF-8-BOM encoding and by changing it to simple UTF-8 everything was fixed.

How to delete read more span on single post view?

As stated in the docs, if the quicktag <!–more–> is used in a post to designate the “cut-off” point for the post to be excerpted, the_content() tag will only show the excerpt up to the <!–more–> quicktag point on non-single/non-permalink post pages. WordPress adds <span id=”more-‘ . $post->ID . ‘”></span> to the content in this … Read more

Custom Template 404 for specific custom post type

This is going to track only post_type query var, but you also can add checks for query_vars of all your post_types or only ones you would like to get a custom 404 page for. add_filter( ‘404_template_hierarchy’, function( $templates ) { global $wp_query; if ( ” !== $wp_query->get(‘post_type’) ) { array_unshift( $templates, sprintf( ‘%s-404.php’, $wp_query->get(‘post_type’) ) … Read more