Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress The WordPress Template Hierarchy Homepage Templates in WordPress front-page.php

Blog post landing page loading front-page.php

I just assigned (via appearance->customize) the front page of my site to display "a static page".
I added some marking text to front-page.php to help me visualize which template was being loaded and as expected front-page.php loaded as the landing page.
However, when I switched the front page to display "your latest posts", front-page.php was still being used, however it now contained the blog posts. Home.php was never loaded as zach and http://wphierarchy.com indicate.
...what's going on here?

3 Answers


front-page.php can display both static pages or posts and will take priority over home.php.

home.php would take affect if you had a static page set and then wanted to display posts on a separate page.

Here's the info from the Codex which was found via The WordPress Template Hierarchy.

This is an excerpt from that Codex page: *The Front Page template takes precedence over the Blog Posts Index (Home) template. *

Hope that helps :)


These are my notes after reading the documentation and messing around on my own hope it'll help someone:

-If SETTINGS -> READING -> your latest posts is selected it'll use 'front-page.php' if file doesn't exist 'home.php' will be used, if it doesn't exist it will use 'index.php' as default

-If SETTINGS -> READING -> a static page is selected, whatever page is selected under 'Homepage' will use 'front-page.php' template file if non-existant it'll use 'page.php' if not 'singular.php' and if not it'll default back to 'index.php'

-If SETTINGS -> READING -> a static page is selected, whatever page is selected under 'Posts page' will use 'home.php' if non-existant it'll default back to index.php

-All remaining pages will look for custom page types so if you have a slug like 'cars' it will look for 'page-cars.php' and it'll use that template file for the page if not it'll continue to look for 'page-{id}.php' if there is an id set, if not it'll look for 'page.php' if non-existant it'll look for 'singular.php' and if non-existant it'll use 'index.php' see full precedence order here: https://developer.wordpress.org/themes/basics/template-hierarchy/#single-page

Great response, explains everything...thanks!

Just to follow-up can you confirm this:
as long as front-page.php exists, it will be used as the template to populate the front-page, regardless if we are displaying a static page or posts.
If front-page.php does not exist, and we are displaying a static front-page, WP will fallback to page.php.
If front-page.php does not exist and we are displaying posts on the front page, then WP will fallback to home.php

Hi Nijad,

No problem. Yes if you are only making use of one or the other, e.g. only having a static page or only having posts, the front-page.php will take priority.

If you decide to have a static home page and a separate blog page, the home page will use front-page.php and the blog page will take home.php.

Hope that helps :)