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 trialDominik Hlusiak
605 PointsDefault 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
Rich Bagley
25,869 PointsHi 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
605 PointsHi 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 (?):
- front-page.php exists? If yes then use it otherwise continue.
- home.php exists? If yes then use it otherwise continue.
- 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