Theme Development for Custom Front Page Templates

Theme Template Files

Developing Theme template files that incorporate the static front page feature requires understanding of the WordPress Template Hierarchy.

On the site front page, WordPress will always use the front-page.php template file, if it exists. If front-page.php does not exist, WordPress will determine which template file to use, depending on the user configuration of ‘Settings > Reading ->Front page displays’, as follows:

A static page: WordPress uses the Static Page template hierarchy: Custom Page Template, page-{id}.php, page-{slug}.php, page.php, index.php
Your latest posts: WordPress uses the Blog Posts Index template hierarchy: home.php, index.php
Custom Site Front Page Template

To create a custom site front page template, include either of the following in the Theme:

front-page.php
A Custom Page Template (e.g. template-featured.php for featured content)
Custom Blog Posts Index Page Template

To create a custom blog posts index template, include the following in the Theme:

home.php
Use only the home.php template file for the blog posts index. Do not use a Custom Page Template (such as template-blog.php) for two reasons:

When the static front page feature is configured properly, WordPress will not use a Custom Page Template to display the blog posts index, even if a Custom Page Template is assigned to the page designated as the “Posts page”. WordPress will only use either home.php or index.php.
When the Custom Page Template is assigned to a static page other than the one designated as the “Posts page,” the blog posts index loop pagination will not work properly.

Our Partners