0

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.

2 Answers 2

1

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

-2

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

3
  • home.php does not override front-page.php for static front page. Commented Sep 14, 2011 at 1:12
  • yes correct it doesnt - just tried it out - it does however override index.php for the posts page Commented Sep 14, 2011 at 1:15
  • Sorry for the bad info , i was sure but it seems it go it wrong
    – chifliiiii
    Commented Sep 15, 2011 at 22:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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