[wp-trac] [WordPress Trac] #28763: Behavior of template heirarchy in settings -> reading when posts page is set but not front page displays

WordPress Trac noreply at wordpress.org
Sun Jul 6 15:36:48 UTC 2014

#28763: Behavior of template heirarchy in settings -> reading when posts page is
set but not front page displays
 Reporter:  Frumph        |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Themes        |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  template

Comment (by chipbennett):

 > Setting a post page but not a front page displays (in settings ->
 reading), makes both the landing page and the page set to posts use the
 home.php template (i.e. both are is_home()), should the landing page (root
 page) be default to front-page.php instead (if) posts page is used?

 I see this as valid core behavior, rather than a bug. The two options
 `get_option( 'page_on_front' )` and `get_option( 'posts_page' )` have no
 meaning unless `'page' == get_option( 'show_on_front' )`.

 There are valid reasons for leaving the two page options set, but have
 `'show_on_front'` changed between `'page'` and `'posts'`. The most obvious
 one is testing. A user (or developer) may want to alternate between having
 the front page display a static page and the blog posts index (e.g. to see
 which one is preferred).

 > No option set on the front page display also makes both locations the
 blog loop and the landing page register as is_home(), while at this point
 they are indeed different.

 Are you sure about this?

 Unless '`page' == get_option( 'show_on_front' )`, the page set as
 `get_option( 'front_page' )` will be displayed not as the site front page,
 but rather as a normal static page.

 I believe the relevant handling is in
 includes/query.php#L1683 query.php, on lines 1683-1689]:
 if ( $qv['page_id'] ) {
     if  ( 'page' == get_option('show_on_front') && $qv['page_id'] ==
 get_option('page_for_posts') ) {
         $this->is_page = false;
         $this->is_home = true;
         $this->is_posts_page = true;

 In other words, unless `'page' == get_option('show_on_front')`, when the
 Page ID is queried, `is_page()` is true, '''`is_home()` is false''', and
 `is_front_page()` is false.

 > forcing the system to consider the posts page is_home() and the landing
 page is_front_page() '''regardless if a page is specifically selected'''

 I'm not following this last part. How can there be a landing page if a
 page is '''not''' specifically selected (as the landing page)?

Ticket URL: <https://core.trac.wordpress.org/ticket/28763#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list