Understanding WordPress Template Hierarchy

WordPress first determines whether it has a static front page. If a static front page has been set, then WordPress loads that page according to the page template hierarchy. WordPress Template Hierarchy is like the figure below.


If a static front page has not been set, then WordPress looks for a template file called home.php and uses it to generate the requested page.
If home.php is missing, WordPress looks for a file called index.php in the active theme’s directory, and uses that template to generate the page.

The main thing to remember about the hierarchy is that the farther right the template appears, the more general it is. Any template file format to the left of the one on the same row is more specific to a certain page or type, and is given priority.


Leave a Reply

Your email address will not be published. Required fields are marked *