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 trialEdward Knack
Courses Plus Student 3,351 PointsSeems like a chose the right answer for this questions, but it's saying "Bummer"
To the question: When you show blog posts as the homepage, what template does WordPress first look to use? I don't know why front-page.php is not the right answer. It seems like the Treehouse lesson is teaching and the template-hierarchy graphic shows that when on the home page, whether its a post or page, Wordpress always looks for front-page.php first.
3 Answers
Jacob Mishkin
23,118 Pointsthe question key word here is blog posts. If you look at the template-hierarchy here scroll down to you'll find static front page. There you will see front-page.php. If you look one block down you will see blog posts index page. there you will find home.php. That is the difference between the two.
Edward Knack
Courses Plus Student 3,351 PointsThank you for this response, but the thing I am still stuck on is that there are two places that seem to describe how front-page.php, if it exists, will be used for home page blogs in place of home.php. If these following descriptions are referring to something altogether different. Please explain what different scenario is being described compared to my question.
1) quoted from https://developer.wordpress.org/themes/basics/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. The template file home.php is used to render the blog posts index. If front-page.php exists, it will override the home.php template."
2) from the transcription of "The WordPress Template Hierarchy" Treehouse video :
"But if we have a blog posts index page, or our homepage site is showing blog posts, then that's controlled by the home.php file. So on our homepage now, we can see the latest blog posts displaying. and the home.php file taking over However, if we still have a front-page.php, that's continuing to work for this home page." (uses front-page.php not home.php)
Jacob Mishkin
23,118 PointsYes. front-page.php has precedence in the rendering of the front-page in WordPress. The question being asked in the quiz only talks about the blog-post-index as the front page. If you want a static front page that shows your posts, home.php is kinda what you want to use rather than front-page.php.
home.php is intended to be used for the homepage of your Blog. front-page.php is used for a landing page, or as the name suggests the front page of the site. This is why if you have both, front-page.php will have precedence over home.php because its purpose is to be the front-page template.
Edward Knack
Courses Plus Student 3,351 PointsOK I think I got it now. I was the phrase "first look to use" that threw me off. The question reads "When you show blog posts as the homepage, what template does WordPress first look to use?" So the answer is that it will first look for home.php but actually use front-page.php, if present, because it has precedence. Thanks for sticking with me on this question.
Jacob Mishkin
23,118 PointsNot entirely. First, If you want to show the blog posts on the homepage you use home.php if a landing page then front-page.php. you will not have both in your file. It does not actually use front-page.php instead of home.php because front-page.php will not exist because you wrote a home.php file not a front-page.php file.