[wp-hackers] the home.php problem: does it asks for a, posts.php?

Ryann Micua ryannmicua at gmail.com
Wed Aug 29 00:38:23 UTC 2012

I think you guys need to take a look at the template hierarchy again. 
There's even a picture 

First off, front-page.php and home.php are different.

Basically, it works like this. If you put front-page.php file in your 
theme, it will fire every time you visit the home page.


Even if you set Settings->Reading to "Latest Posts" or Static Page, this 
template will be used if it is present. The only difference is what's 
available in the queried object. Look at the picture - the *first* black 
box encountered tells you which template will be loaded (if the template 
file is present that is)

If you put home.php template file in your theme, then this template will 
fire only if you are looking at the Blog Posts Index page but only if 
front-page.php hasn't been fired. Now there are only 2 situations where 
the home.php template file will load and this is when:

1. Settings -> Reading is set to Latest Posts and (this is important) 
*there is no front-page.php file present*. If front-page.php is present, 
then that is the template that will be used, not home.php.
2. Settings -> Reading is set to static page and the page that you are 
looking at right now is the page that is specified as the Posts page

So, if you want to FORCE what will be displayed on the front page, then 
create a front-page.php file. If you're the kind who wants to give the 
end user a choice, then you can either create a home.php file or use a 
page template depending on how you've set up your theme - but do not 
create a front-page.php file.

As for giving end users the option of what to display on the home page, 
I think it boils down to "how much control can I give the user without 
them breaking the site?" Sure, you can give the user options but also be 
prepared to code your theme in such a way so that any option the user 
chooses will still look good.

The point is, the developer has the tools needed to either make a theme 
that *dictates* what should be shown on the frontpage or make it 
possible to give the end user a choice. All in all, it's up to the 
developer to give or take away that choice. Assuming of course the 
developer actually understands the system they are using and know what 
they're doing..

*Ryann Micua*
/Web Developer/

Website: /www.pogidude.com/
Skype: /rmicua/
Mobile: /+639169273059/

More information about the wp-hackers mailing list