WordPress.org

Make WordPress Core

Ticket #6801: 6801.diff

File 6801.diff, 2.3 KB (added by Denis-de-Bernardy, 9 years ago)
  • wp-includes/template-loader.php

     
    2323        } else if ( is_tax() && $template = get_taxonomy_template()) {
    2424                include($template);
    2525                return;
     26        } else if ( is_front_page() && !is_home() && $template = get_front_page_template() ) {
     27                include($template);
     28                return;
    2629        } else if ( is_home() && $template = get_home_template() ) {
    2730                include($template);
    2831                return;
     
    7578        }
    7679}
    7780
    78 ?>
    79  No newline at end of file
     81?>
  • wp-includes/theme.php

     
    675675 * @return string
    676676 */
    677677function get_home_template() {
    678         $template = locate_template(array('home.php', 'index.php'));
    679         return apply_filters('home_template', $template);
     678        $templates = array();
     679        if ( is_front_page() )
     680                $templates[] = 'front-page.php';
     681        $templates[] = 'home.php';
     682        $templates[] = 'index.php';
     683        return apply_filters('home_template', locate_template($templates));
    680684}
    681685
    682686/**
     687 * Retrieve path of front-page template in current or parent template.
     688 *
     689 * First attempt is to look for the file in the '_wp_page_template' page meta
     690 * data. The second attempt, if the first does not have a file or it's empty, is
     691 * to look for 'front-page.php' before falling back to 'page.php' and ultimately
     692 * falling back to 'index.php' if none of these exist.
     693 *
     694 * @since 2.9.0
     695 * @uses apply_filters() Calls 'front_page_template' on file path of template.
     696 *
     697 * @return string
     698 */
     699function get_front_page_template() {
     700        global $wp_query;
     701
     702        $id = (int) $wp_query->post->ID;
     703        $template = get_post_meta($id, '_wp_page_template', true);
     704
     705        if ( 'default' == $template )
     706                $template = '';
     707
     708        $templates = array();
     709        if ( !empty($template) && !validate_file($template) )
     710                $templates[] = $template;
     711
     712        $templates[] = "front-page.php";
     713        $templates[] = "page.php";
     714
     715        return apply_filters('front_page_template', locate_template($templates));
     716}
     717
     718/**
    683719 * Retrieve path of page template in current or parent template.
    684720 *
    685721 * First attempt is to look for the file in the '_wp_page_template' page meta