Add a template for static front page to the template hierarchy.
Website homepages often need a different layout to other site pages. In the same way that template home.php is applied to the front of the blog, how about having a frontpage.php template that is used when is_front_page()=true? Currently I'm using is_front_page() within my page.php and separating this out into another template would make using child themes easier and speed up theme development.
Possible drawback: conflict with default theme?
Answer: default theme would not have a frontpage.php included.
Possible drawback: how to handle conflict with choice of page template in page editor?
Answer: probably best if presence of template file overrides this option. That's certainly my intent. I want to be able to set a different home page template for a client without the need to set it in the editor.
Why not just create a page template? I seldom use a home.php file in a theme. I simply set which "Page" is the homepage in the Settings>reading options.
You can create as many page templates as you want. Build your homepage in any layout adding the php page template comment at the top of the file and select it in the page's attributes (Template). You can display the Page content and run one or more custom query loops after to display whatever category posts you desire.
The hierarchy method WordPress uses is pretty archaic and in many ways, WP has outgrown it -- even templates are handled differently between category posts and Pages. (I suspect because Pages came later and inability to have one template for many categories was painfully obvious.)
No need to add yet another file to hierarchy, imo.
Edited to add: How are you planning to use the is_front_page() function conditionally? You don't use it in a link... it's typically used for conditional if/elseif/else statements
I don't see much point in this either. You can easily use a page template for this. Seeing that pages in 2.9 will be checking for the existence of 5 files (custom template,
index.php), do we really need a check for a 6th template? Also, note that with child themes, WordPress checks for these files in both the child and parent theme, so it'll technically be checking for 10 files in 2.9.
RSS feed for this topic
This topic has been closed to new replies.