Title: Demystifying Home and Posts Templates in WordPress theme development
Author: Daisy Olsen
Published: November 17, 2022
Last modified: November 2, 2023

---

 * [Showcase](https://wordpress.org/showcase/)
 * [Plugins](https://wordpress.org/plugins/)
 * [Themes](https://wordpress.org/themes/)
 * [Hosting](https://wordpress.org/hosting/)
 * [News](https://wordpress.org/news/)
    - [Learn WordPress](https://learn.wordpress.org/)
    - [Documentation](https://wordpress.org/documentation/)
    - [Education](https://wordpress.org/education/)
    - [Forums](https://wordpress.org/support/forums/)
    - [Developers](https://developer.wordpress.org/)
    - [Blocks](https://wordpress.org/blocks/)
    - [Patterns](https://wordpress.org/patterns/)
    - [Photos](https://wordpress.org/photos/)
    - [Openverse ︎](https://openverse.org/)
    - [WordPress.tv ︎](https://wordpress.tv/)
 *  - [About WordPress](https://wordpress.org/about/)
    - [Make WordPress](https://make.wordpress.org/)
    - [Events](https://events.wordpress.org/)
    - [Five for the Future](https://wordpress.org/five-for-the-future/)
    - [Enterprise](https://wordpress.org/enterprise/)
    - [Gutenberg ︎](https://wordpress.org/gutenberg/)
    - [Job Board ︎](https://jobs.wordpress.net/)
 * [Swag ︎](https://mercantile.wordpress.org/)
 * [Get WordPress](https://wordpress.org/download/)

Search in WordPress.org

 [ Get WordPress ](https://wordpress.org/download/)

[WordPress Developer Blog](https://developer.wordpress.org/news)

 * [Snippets](https://developer.wordpress.org/news/snippets/)
    - [Blocks](https://developer.wordpress.org/news/category/blocks/)
    - [Concepts](https://developer.wordpress.org/news/category/concepts/)
    - [Common APIs](https://developer.wordpress.org/news/category/common-apis/)
    - [Design](https://developer.wordpress.org/news/category/design/)
    - [Playground](https://developer.wordpress.org/news/category/playground/)
    - [Plugins](https://developer.wordpress.org/news/category/plugins/)
    - [Themes](https://developer.wordpress.org/news/category/themes/)
 *  - [About this site](https://developer.wordpress.org/news/about/)
    - [Updates](https://developer.wordpress.org/news/category/updates/)
    - [How to contribute](https://developer.wordpress.org/news/how-to-contribute/)
    - [Tips and guidelines](https://developer.wordpress.org/news/tips-and-guidelines-for-writers/)
 * [Subscribe](https://developer.wordpress.org/news/subscribe/)
 * [Developer Resources](https://developer.wordpress.org/)

 * [Snippets](https://developer.wordpress.org/news/snippets/)
    - [Blocks](https://developer.wordpress.org/news/category/blocks/)
    - [Concepts](https://developer.wordpress.org/news/category/concepts/)
    - [Common APIs](https://developer.wordpress.org/news/category/common-apis/)
    - [Design](https://developer.wordpress.org/news/category/design/)
    - [Playground](https://developer.wordpress.org/news/category/playground/)
    - [Plugins](https://developer.wordpress.org/news/category/plugins/)
    - [Themes](https://developer.wordpress.org/news/category/themes/)
 *  - [About this site](https://developer.wordpress.org/news/about/)
    - [Updates](https://developer.wordpress.org/news/category/updates/)
    - [How to contribute](https://developer.wordpress.org/news/how-to-contribute/)
    - [Tips and guidelines](https://developer.wordpress.org/news/tips-and-guidelines-for-writers/)
 * [Subscribe](https://developer.wordpress.org/news/subscribe/)
 * [Developer Resources](https://developer.wordpress.org/)

# 󠀁[Demystifying Home and Posts Templates in WordPress theme development](https://developer.wordpress.org/news/2022/11/demystifying-home-and-posts-templates-in-wordpress-theme-development/)󠁿

By [Daisy Olsen](https://profiles.wordpress.org/daisyo/)

November 17, 2022

[Beginners](https://developer.wordpress.org/news/category/beginners/), [Themes](https://developer.wordpress.org/news/category/themes/)

A WordPress user can choose the type of content displayed on the homepage. A new
WordPress site’s default behavior is to display a view of the website’s most recent
posts. However, it is also possible to set a static page as the homepage.

Changing the default behavior to display a static page can be done by visiting **
Settings > Reading** in the WordPress admin area. From there, the user can select
published pages for the homepage and posts page. In this case, displaying a static
page at the site root means the latest posts will appear on a separate dedicated
static page.

As a theme developer, creating the best scenario for end users may seem complex,
and it may be helpful to view things at a higher level.

## The WordPress template hierarchy

As a theme developer, you will likely be familiar with the[ WordPress template hierarchy](https://developer.wordpress.org/themes/basics/template-hierarchy/).
If not, it’s a good idea to learn more about it. The template hierarchy is one of
the most important things to understand when building a theme. The WordPress template
hierarchy works, along with the active theme, to determine what template file will
generate any given view of a WordPress site. Highly recommended is [this tutorial on LearnWordPress.org](https://learn.wordpress.org/tutorial/a-beginners-guide-to-the-wordpress-template-hierarchy/),
covering the basics of the WordPress template hierarchy.

The template hierarchy attempts to locate a template for the page a site visitor
is viewing, looking for templates in order of specificity, and falling back to the
generic index template if no other templates are found.

For sites with user-level templates created in the Site Editor, the hierarchy remains
the same, except that the templates may not be drawn from the active theme as the
user changes, stored in the database, will be used.

WordPress will look for templates in the following order, using the one it finds
first:

 * user (Site Editor)
 * active theme
 * parent theme (if a child theme is active)

The file extension and location of files within the theme directory will depend 
on the type of theme you are creating. A **classic theme** will have PHP files, 
typically located in the theme’s root directory, while a **block theme** will have
HTML files in a folder named “templates”.

_Template names are referenced below without file extensions. File extensions will
be either .php for the classic themes or .html for block themes. _

## Templates for latest posts as homepage

WordPress will use the first template found for the homepage from the following 
list:

 * front-page
 * home
 * index

![Latest posts template hierarchy](https://developer.wordpress.org/news/files/2022/
10/latests-posts-hierarchy.png)

## Templates for a static homepage and posts page

When a static page is selected for the homepage display, a homepage and posts page
can be set from a list of published pages on the site. The page specified in the
homepage option will be displayed at the site root.

If a static page is set for the homepage, WordPress will use the first template 
found for the homepage from the following list:

 * front-page
 * custom page template (set at page level)
 * page
 * singular
 * index

![Static page "homepage" template hirarchy](https://developer.wordpress.org/news/
files/2022/10/static-homepage-hirrarchy.png)

There are just two potential template options for a static posts page:

 * home
 * index

A published page set as the posts page will not use a custom page template. Generally,
this page will not display a page title or content unless the template includes 
the page title and content explicitly.

![Static page "posts page" template hierarchy](https://developer.wordpress.org/news/
files/2022/10/static-posts-page-hierarchy.png)

## Front-page template

The front-page template is one template that benefits from a special mention. If
a front-page template exists anywhere in the chain of template sources, it will 
be used as the homepage template regardless of Reading settings or any custom template
assigned at the page level. It is because of this, a front-page template may not
be the best choice for every theme.

The primary use case for a front-page template would be for a theme or site that
should have a page-style view from the moment of activation, no matter the state
of the reading settings. One use-case could be for a dynamic homepage that differs
from a traditional latest posts page. Alternatively, a site with a specific homepage
design could benefit from using a **front-page** template.

## Static posts page

When assigning the latest posts to a static page, the front-end view will not generally
display the page title or content as if it were a standard page. It will, instead,
derive the content from either the home template or the index template. The page
acts as a placeholder, allowing the templates to display the latest posts.

The WordPress template hierarchy is a powerful part of the theme engine for WordPress,
whether you are building a Classic theme, a Block Theme, or using the Site Editor
to customize or extend an existing theme. This post covers just a brief look at 
one aspect of the template hierarchy.

How will you use the Home and Posts templates in your next project? Feedback and
comments are welcome below.

## Resources to learn more

 * [A beginner’s guide to the WordPress template hierarchy](https://wordpress.tv/2022/10/28/a-beginners-guide-to-the-wordpress-template-hierarchy/)(
   WordPress TV)
 * [Template Hierarchy](https://developer.wordpress.org/themes/basics/template-hierarchy/)(
   Documentation)
 * [Theme Handbook](https://developer.wordpress.org/themes/) (Documentation)

_Props to [@greenshady](https://profiles.wordpress.org/greenshady/), [@bph](https://profiles.wordpress.org/bph/)_
_and [@webcommsat](https://profiles.wordpress.org/webcommsat/) for review_

**Categories:** [Beginners](https://developer.wordpress.org/news/category/beginners/),
[Themes](https://developer.wordpress.org/news/category/themes/)

**Tags:** [Block themes](https://developer.wordpress.org/news/tag/block-themes/),
[Classic themes](https://developer.wordpress.org/news/tag/classic-themes/), [Template Hierarchy](https://developer.wordpress.org/news/tag/template-hierarchy/)

### Leave a Reply 󠀁[Cancel reply](https://developer.wordpress.org/news/2022/11/demystifying-home-and-posts-templates-in-wordpress-theme-development/?output_format=md#respond)󠁿

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

Comment *

Name *

Email *

Website

 Save my name, email, and website in this browser for the next time I comment.

 Notify me of follow-up comments by email.

 Notify me of new posts by email.

Δ

## Have an idea for a new post?

### 󠀁[Learn how to contribute](https://developer.wordpress.org/news/how-to-contribute/)󠁿

Share your knowledge with fellow WordPress developers.

Search

### 󠀁[Review tips and guidelines](https://developer.wordpress.org/news/tips-and-guidelines-for-writers/)󠁿

Everything you need to know about writing for the Blog.

## Subscribe to the Blog

  Email Address

 Join 1,774 other subscribers

 * [About](https://wordpress.org/about/)
 * [News](https://wordpress.org/news/)
 * [Hosting](https://wordpress.org/hosting/)
 * [Privacy](https://wordpress.org/about/privacy/)

 * [Showcase](https://wordpress.org/showcase/)
 * [Themes](https://wordpress.org/themes/)
 * [Plugins](https://wordpress.org/plugins/)
 * [Patterns](https://wordpress.org/patterns/)

 * [Learn](https://learn.wordpress.org/)
 * [Documentation](https://wordpress.org/documentation/)
 * [Developers](https://developer.wordpress.org/)
 * [WordPress.tv ](https://wordpress.tv/)

 * [Get Involved](https://make.wordpress.org/)
 * [Events](https://events.wordpress.org/)
 * [Donate ](https://wordpressfoundation.org/donate/)
 * [Swag ](https://mercantile.wordpress.org/)

 * [WordPress.com ](https://wordpress.com/?ref=wporg-footer)
 * [Matt ](https://ma.tt/)
 * [bbPress ](https://bbpress.org/)
 * [BuddyPress ](https://buddypress.org/)

 The WordPress® trademark is the intellectual property of the WordPress Foundation.

 * [Visit our X (formerly Twitter) account](https://www.x.com/WordPress)
 * [Visit our Bluesky account](https://bsky.app/profile/wordpress.org)
 * [Visit our Mastodon account](https://mastodon.world/@WordPress)
 * [Visit our Threads account](https://www.threads.net/@wordpress)
 * [Visit our Facebook page](https://www.facebook.com/WordPress/)
 * [Visit our Instagram account](https://www.instagram.com/wordpress/)
 * [Visit our LinkedIn account](https://www.linkedin.com/company/wordpress)
 * [Visit our TikTok account](https://www.tiktok.com/@wordpress)
 * [Visit our YouTube channel](https://www.youtube.com/wordpress)
 * [Visit our Tumblr account](https://wordpress.tumblr.com/)