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

Cristinel Laurentiu
Cristinel Laurentiu
1,821 Points

Bypass front-page.php

And how we overwrite front-page.php template or display actually just the latest post if we setup the latest post as the home page? I am getting displayed the latest posts and the portfolio - so the front-page.php it's displayed, in the same time if I setup the latest posts as the front page WordPress it's deactivating my options where I assign the page for the front page and the posts page

2 Answers

Flor Antara
Flor Antara
12,372 Points

Hi Cristinel,

So when you set from WordPress that you want a specific page to be your Front Page, it will look for front-page.php and if that file exists, it will use that. If there is not a front-page.php, it'll start scanning through the Template Hierarchy. Chances are that either page.php or index.php are taking place.

Now, if you set that you want your Latest Posts to be in your Front Page, WordPress will look for a file called home.php (I know, it's confusing!). If you don't have a home.php it will jump to the next option in the Template Hierarchy, but this option will never use the front-page.php file.

So... if you want to use your front-page.php, and have your latest posts there as well, an option is to add a Loop to it that displays your latest posts.

Cristinel Laurentiu
Cristinel Laurentiu
1,821 Points

Hi Flor, Thank You for your answer.....I understood the template hierarchy and the way WordPress fallback works just if I follow the instructions in the course and I have a front-page.php template but I setup the latest posts as the home page from the WordPress dashboard on the actual front page of the website I am getting the info from home.php + the content from the front-page.php...removing front-page.php it's working as expected...that's why I placed this questions. I understood though that a lot of devs do not use front-page.php