Template Hierarchy

Template Hierarchy

WordPress uses different types of template files for different types of content. Some templates are used to create full pages or posts while other template files are used to include additional content or instructions within pages and posts.

Templates for pages and posts are arranged hierarchically. WordPress looks first for a custom template for your page, then if that doesn't exist it looks one level up for a less specific version of the page.

For example if you have a page about squirrels, WordPress might check to see if you've created a custom page template for the squirrels page. If you have not it might look for page.php. If that doesn't exist it will look for index.php. There are many levels of allowed customizations you may use depending on what type of page you are creating.

Templates for pages and posts
index.php
Typically used for your site's home page, this is the top level template file. It will also be used as the default for pages or posts if more specific templates don't exist.
home.php
Typically used for your blog's home page. If this doesn't exist index.php will be used instead.
page.php
Typically used for regular site pages. If this doesn't exist index.php will be used instead.
single.php
Typically used for individual blog posts. If this doesn't exist index.php will be used instead.
Template Resources