[wp-trac] [WordPress Trac] #23669: Allow front page template to fall back to home template when site displays blog posts index on front page

WordPress Trac noreply at wordpress.org
Sat Mar 2 21:15:26 UTC 2013


#23669: Allow front page template to fall back to home template when site displays
blog posts index on front page
-------------------------------------+-------------------------
 Reporter:  chipbennett              |       Type:  enhancement
   Status:  new                      |   Priority:  normal
Milestone:  Awaiting Review          |  Component:  Template
  Version:  3.5.1                    |   Severity:  normal
 Keywords:  has-patch needs-testing  |
-------------------------------------+-------------------------
 The `front-page.php` template file is intended to define custom, static
 front page content. However, this template file takes precedence,
 regardless of whether `get_option( 'show_on_front' )` is set to `'posts'`
 or `'page'`.

 If the user sets the front page to display the blog posts index, this
 choice is effectively superseded by `front-page.php`, and the blog posts
 index is not displayed unless the Theme specifically accounts for this
 setting in the template file, using something like so:

 {{{
  if ( 'posts' == get_option( 'show_on_front' ) ) {
      get_template_part( 'home' );
  } else {
      // front page markup goes here
  }
  }}}

 But requiring all Themes to include such a conditional in `front-page.php`
 essentially defeats the purpose of the the `front-page.php` file in the
 template hierarchy.

 Instead, WordPress should consider `get_option( 'show_on_front' )`, and
 should return ''either'' `front-page.php` (for `'page'`) ''or'' `home.php`
 (for `'posts'`) on the site front page.

 Attached patch modifies `get_front_page_template()` accordingly.

 Impact to current Themes is almost certainly minimal to none, for Themes
 that already properly use `front-page.php` and `home.php`.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/23669>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list