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.

When do I use the following:

  • home.php
  • frontpage.php
  • Under Settings > Reading Settings
    • Front Page
    • Posts Page

I wish to clarify this as I find myself using "Placeholder Pages", empty pages just for the sake of a menu item and to display blog listings.

If I use a Static Front Page (Set under Settings > Reading Settings > Front Page) how do I access my posts page? Do I need to have a "Placeholder Page" titled blog and use page-blog.php?

share|improve this question
add comment

1 Answer 1

up vote 6 down vote accepted

You don't ever directly use (as in, select as a Page template) either front-page.php or home.php. WordPress uses these template files automatically, according to the Template Hierarchy rules.

  • The front-page.php template file is used to display Site Front Page, whether you have set the site front page to display a static Page or the Blog Posts Index.
  • The home.php template file is used to display the Blog Posts Index, whether the blog posts index is set to display on the Site Front Page or an a separate static Page.
  • The front-page.php template file will override home.php on the Site Front Page.
  • The home.php template file will override page.php (or any page-{custom-template}.php selections) on *non-front page static Pages`.

If I use a Static Front Page (Set under Settings > Reading Settings > Front Page) how do I access my posts page? Do I need to have a "Placeholder Page" titled blog and use page-blog.php?

To display the Blog Posts Index on a non-front page static Page:

  • Create a new static Page, with any arbitrary title ("Blog", "News", or anything else you want), and leave the Page Content blank/empty

  • Under Dashboard -> Settings -> Reading, set "Posts Page" to the static Page you just created.

Really; that's it. If you want to customize the display of your static-page-as-blog-posts-index, simply modify the home.php template file. Creating a page-blog.php template file will have no effect.

share|improve this answer
    
You said "You don't ever directly use (as in, select as a Page template)", do you mean if I want a static front page, I should create a page like "Home" with no content, create a custom template for it page-home.php then select that to be the home page? –  Jiew Meng Jan 8 '12 at 10:39
1  
@jiewmeng see the Creating a Static Front Page Codex entry. The only time that creating your own custom page template for a static front page will work is if your Theme does not include a front-page.php template file. See also: Template Hierarchy. –  Chip Bennett Jan 8 '12 at 16:08
    
In other words, I should create a page-home.php and an empty page "Home" if I want to have my front page display my latest 3 posts & latest 3 portfolio (custom post type)? Just to confirm my understanding –  Jiew Meng Jan 9 '12 at 0:49
1  
"I should create a page-home.php and an empty page "Home" if I want to have my front page display my latest 3 posts & latest 3 portfolio (custom post type)?" - actually, I would use front-page.php for that purpose. That way, you don't have to worry about selecting the custom page template; instead, you simply select the appropriate static Page via Dashboard -> Settings -> Reading, and you're done. –  Chip Bennett Jan 9 '12 at 5:01
add comment

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.