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
?
You don’t ever directly use (as in, select as a Page template) either
front-page.php
orhome.php
. WordPress uses these template files automatically, according to the Template Hierarchy rules.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.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.front-page.php
template file will overridehome.php
on the Site Front Page.home.php
template file will overridepage.php
(or anypage-{custom-template}.php
selections) on *non-front page static Pages`.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 apage-blog.php
template file will have no effect.