Sierra Dafoe

testing 3

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:

  1. 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.
  2. 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.

Contextual Conditional Tags

is_front_page() 
This Conditional Tag checks if the site front page is being displayed. Returns true when the site front page is being displayed, regardless of whether ‘Settings > Reading ->Front page displays’ is set to “Your latest posts” or “A static page”.
is_home() 
This Conditional Tag checks if the blog posts index is being displayed. Returns true when the blog posts index is being displayed: when the site front page is being displayed and ‘Settings > Reading ->Front page displays’ is set to “Your latest posts”, or when ‘Settings > Reading ->Front page displays’ is set to “A static page” and the “Posts Page” value is the current Page being displayed.

When the site front page is being displayed and ‘Settings > Reading ->Front page displays’ is set to “Your latest posts”, both is_front_page() and is_home() will return true.

Configuration of front-page.php

If it exists, the front-page.php template file is used on the site’s front page regardless of whether ‘Settings > Reading ->Front page displays’ is set to “A static page” or “Your latest posts,” the Theme will need to account for both options, so that the site front page will display either a static page or the blog posts index. There are a few methods to do so.

Conditional display within front-page.php

One way to allow front-page.php to account for both options for ‘Settings > Reading ->Front page displays’ is to add a conditional inside of front-page.php itself, using get_option( 'show_on_front' ), get_home_template(), and get_page_template().

Method 1: including custom content directly within front-page.php:

Posted in testing

In Archive