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

front-page.php Vs home.php

If front-page.php exist, will always take control even if i choose blog posts as the homepage. This Zac show on his course:

"If we come into our theme, it's going to be the home.php file that takes over here. However, if we still have a front-page.php, that's continuing to work for this home page."

So, if i understand right, at the question:

"When you show blog posts as the homepage, what template does WordPress first look to use?"

The answer should be front-page.php, and not home.php, because this is used only when front-page.php file don't exist.

Am i wrong?

Thanks

Ok, it seems i'm right, so this means that the course test was wrong because the question:

"When you show blog posts as the homepage, what template does WordPress first look to use?" accept the answer "home.php" like correct, and "front-page.php" as wrong.

On this topic i didn't find the video course so clear.

Thanks everybody.

4 Answers

Yes, it's front-page.php. This might help explain things: http://www.wphierarchy.com/

Kevin Korte
Kevin Korte
28,149 Points

I believe you're right. Here is right out of the WP Codex

Home Page display

Template file used to render the Blog Posts Index, whether on the site front page or on a static page. Note: on the Site Front Page, the Front Page template takes precedence over the Blog Posts Index (Home) template.

  • home.php
  • index.php

Front Page display

Template file used to render the Site Front Page, whether the front page displays the Blog Posts Index or a static page. The Front Page template takes precedence over the Blog Posts Index (Home) template.

  • front-page.php - Used for both Your latest posts or A static page as set in the Front page displays section of Settings -> Reading
  • Page display rules - When Front page is set in the Front page displays section of Settings -> Reading
  • Home Page display rules - When Posts page is set in the Front page displays section of Settings -> Reading

http://codex.wordpress.org/Template_Hierarchy

Andrew Chappell
Andrew Chappell
12,782 Points

If you go into Settings > Reading there is a radio button that says Front Page Displays either: Your Latest Posts or A Static Page. If you select Latest Posts as your home page then Wordpress will display the home.php file. If you select A Static Page, Wordpress will use front-page.php as your home page.

The answer should be front-page.php.