When do I use the following:
- home.php
- frontpage.php
- Under Settings > Reading Settings
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
?
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.