WordPress.org

Make WordPress Core

Ticket #23669: template.php.front_page_template.use.home_template.diff

File template.php.front_page_template.use.home_template.diff, 890 bytes (added by chipbennett, 6 years ago)

Allow get_front_page_template() to be aware of get_option( 'show_on_front' )

  • .

     
    208208
    209209/**
    210210 * Retrieve path of front-page template in current or parent template.
     211 *
     212 * If site is configured to display the posts page as the site front page,
     213 * retrieves the path of the home template; otherwise, looks for 'front-page.php'.
    211214 *
    212  * Looks for 'front-page.php'.
    213  *
    214215 * @since 3.0.0
    215216 * @uses apply_filters() Calls 'front_page_template' on file path of template.
    216217 *
    217218 * @return string
    218219 */
    219220function get_front_page_template() {
    220         $templates = array('front-page.php');
     221        if ( 'posts' == get_option( 'show_on_front' ) ) {
     222                get_home_template();
     223        } else {
     224                $templates = array('front-page.php');
    221225
    222         return get_query_template( 'front_page', $templates );
     226                return get_query_template( 'front_page', $templates );
     227        }
    223228}
    224229
    225230/**