Is the Index template necessary in themes?

There could be edge cases where the index template could be used. For example, a plugin or a future WordPress version could introduce a new template hierarchy “type” that is not covered by any other template. WordPress would use the index template as a fallback in this case. Of note, the WordPress Theme Handbook mentions … Read more

Get the current hierarchy php page

Assuming that you’re wanting to determine which template page is currently being displayed, within the template hierarchy, the easiest way to do so is via the output of body_class(). However, if you need to return this information programmatically, the easiest way might be to call get_body_class(), and then evaluate the array of classes returned. Given … Read more

Which page is referring to *all posts by author*?

please refer to the codex: http://codex.wordpress.org/Template_Hierarchy#Author_display however, your problem is caused by a conflict of the .author class output by the body_class() and this existing style in custom.css: .author { float: left; margin-top: -3px; width: 219px; background: #E7ECEF; border-right: 1px solid #D6DFDC; height: 41px; cursor: pointer; } check why this style is added there in … Read more

Front-Page.php and Index.php

You can create a blog page from index.php If you have knowledge on WordPress Template hierarchy and WordPress coding standard you can easily manipulate blog page on your server. Moreover front-page.php will be your home page. Resources Page Template Hierarchy Developer Resources:

About template hierarchy

The answer is simple: /search/query/?category_name=general&post_type=custom is not a part of WordPress and has been added by a plugin/theme, you need to ask their support or inspect the code to find out For everything else, if is_search() is true, then it’s a search archive. If is_search() is not true it is not a search archive. Since … Read more

How to define the template priority between built-in categories and custom taxonomies?

You can tell WordPress what template file to use with the template_redirect hook. add_action( ‘template_redirect’, ‘wpse98738_taxonomy_redirect’ ); function wpse98738_taxonomy_redirect() { if( ‘x’ == $customtax && ‘y’ == $category_name ) { include( get_template_directory() . ‘/taxonomy-customtax.php’ ); // if you’re using a Child Theme, use the following line instead: // include( get_stylesheet_directory() . ‘/taxonomy-customtax.php’ ); exit; // … Read more

Template hierarchy override

To understand how this works, take a look at the source file template-loader.php. Here you see several lines of statements which determine which template WordPress will load. Near the end is the filter, which allows you to undo all the previous lines. For instance, one of the lines determines which template to load if is_single … Read more

tech