Template Hierarchy
By default, WordPress sets your site’s home page to display your latest blog posts. This page is called the blog posts index. You can also set your blog posts to display on a separate static page. The template file home.php is used to render the blog posts index, whether it is being used as the front page or on separate static page. If home.php does not exist, WordPress will use index.php.
home.phpindex.php
The front-page.php template file is used to render your site’s front page. If the front-page.php file does not exist, WordPress will either use the home.php or page.php files depending on the setup in Settings → Reading. If neither of those files exist, it will use the index.php file.
Work with either use latest post and static page homepage displays.
The privacy-policy.php template file is used to render your site’s Privacy Policy page. The Privacy Policy page template takes precedence over the static page (page.php) template. If the privacy-policy.php file does not exist, WordPress will either use the page.php or singular.php files depending on the available templates. If neither of those files exist, it will use the index.php file.
privacy-policy.php
page.php
singular.php
index.php
Rendering category archive index pages uses the following path in WordPress:
category-{slug}.php– If the category’s slug isnews, WordPress will look forcategory-news.php.category-{id}.php– If the category’s ID is6, WordPress will look forcategory-6.php.category.phparchive.phpindex.php
To display a tag archive index page, WordPress uses the following path:
tag-{slug}.php– If the tag’s slug issometag, WordPress will look fortag-sometag.php.tag-{id}.php– If the tag’s ID is6, WordPress will look fortag-6.php.tag.phparchive.phpindex.php
Search results follow the same pattern as other template types:
search.phpindex.php
Likewise, 404 template files are called in this order:
404.phpindex.php
Last updated