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 The WordPress Homepage Templates Quiz

Dominik Hlusiak
Dominik Hlusiak
605 Points

Default Template for Homepage Showing Blog Posts

When setting the homepage to show blog posts isn't the default template still front-page.php? I thought only if that file is missing will WordPress look for home.php. However in the quiz section "front-page.php" is not the correct answer. I am a bit confused and will be grateful for any help. Thanks!

2 Answers

Hi Dominik,

By default a blog post home page will look for home.php first followed by index.php. If front-page.php exists it will use this instead.

Here's the info from the Template Hierarchy page in the WordPress Theme Handbook.

WP Hierarchy is a useful website for reference too.

Hope that helps :)

-Rich

Dominik Hlusiak
Dominik Hlusiak
605 Points

Hi Rich,

thanks for your fast answer :). I really like treehouse and it has been a great experience so far. Your link to the developer section of WordPress is very useful. I think I do understand the hierarchy. However to me the formulation "if x.php exists it will use this instead" implies "it will look for x.php first".

Also in the following section ( https://developer.wordpress.org/themes/basics/template-hierarchy/#front-page-display ) they write: "home.php – If WordPress cannot find front-page.php and β€œyour latest posts” is set in the front page displays section, it will look for home.php".

So isn't it a three step process (?):

  1. front-page.php exists? If yes then use it otherwise continue.
  2. home.php exists? If yes then use it otherwise continue.
  3. index.php exists? If yes then use it otherwise we have a problem.

Would you agree that this means WordPress looks for front-page.php first or is there a misconception on my part?

I'll be thankful for any further clarification on this issue.

Dominik