Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am building a theme and wondering whether or not to include a home.php file or not. The theme (which will not be available to the public) will be mainly used with a static home page and separate blog posts page.

My understanding is that including a front-page.php file means that the static home page would be served by that file; and that if I was to include a home.php file then the blog posts would be served by that.

My question is this: If I was happy to use index.php as my blog posts layout instead of home.php then is there any advantage in having a home.php file ? Or to ask it another way: Is the only purpose of home.php that of allowing separate styling/layout of the blog posts page as compared to that of the index.php template (ie the fallback template). I should add that I have included in the theme most of the other templates ( single, archive, page etc) so I really only expect index.php to be used as a fallback and it will only operate in that regard If I've missed something so hopefully not that often.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

If you look here [is_home vs is_front_page] you'll see that is_front_page() is true regardless of what the homepage is set to in the WordPress settings. This means that if you don't plan on releasing this publicly (i.e. short-run usage) then just having a front-page.php should suffice. is_home() is set based on your blogs page (which may or may not be the homepage, depending on whats set in WordPress Settings)

Also, here's a link to the hierarchy of which templates are chosen under what conditions: Template Hierarchy

share|improve this answer

Actually home.php will override front-page.php for your static front page.

If you dont select blog page in Settings -> Reading , front-page.php will be displayed for blog post if exist. If it dont i will display index.php

share|improve this answer
    
home.php does not override front-page.php for static front page. –  helenhousandi Sep 14 '11 at 1:12
    
yes correct it doesnt - just tried it out - it does however override index.php for the posts page –  byronyasgur Sep 14 '11 at 1:15
    
Sorry for the bad info , i was sure but it seems it go it wrong –  chifliiiii Sep 15 '11 at 22:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.