WordPress.org

Make WordPress Core

Ticket #6801: 6801.005.diff

File 6801.005.diff, 2.0 KB (added by aaroncampbell, 9 years ago)
  • wp-includes/template-loader.php

     
    2626        } else if ( is_home() && $template = get_home_template() ) {
    2727                include($template);
    2828                return;
     29        } else if ( is_front_page() && $template = get_front_page_template() ) {
     30                include($template);
     31                return;
    2932        } else if ( is_attachment() && $template = get_attachment_template() ) {
    3033                remove_filter('the_content', 'prepend_attachment');
    3134                include($template);
     
    7578        }
    7679}
    7780
    78 ?>
    79  No newline at end of file
     81?>
  • wp-includes/theme.php

     
    680680}
    681681
    682682/**
     683 * Retrieve path of front-page template in current or parent template.
     684 *
     685 * First attempt is to look for the file in the '_wp_page_template' page meta
     686 * data. The second attempt, if the first does not have a file or it's empty, is
     687 * to look for 'front-page.php' before falling back to 'page.php' and ultimately
     688 * falling back to 'index.php' if none of these exist.
     689 *
     690 * @since 2.9.0
     691 * @uses apply_filters() Calls 'front_page_template' on file path of template.
     692 *
     693 * @return string
     694 */
     695function get_front_page_template() {
     696        global $wp_query;
     697
     698        $id = (int) $wp_query->post->ID;
     699        $template = get_post_meta($id, '_wp_page_template', true);
     700
     701        if ( 'default' == $template )
     702                $template = '';
     703
     704        $templates = array();
     705        if ( !empty($template) && !validate_file($template) )
     706                $templates[] = $template;
     707
     708        $templates[] = "front-page.php";
     709        $templates[] = "page.php";
     710
     711        return apply_filters('front_page_template', locate_template($templates));
     712}
     713
     714/**
    683715 * Retrieve path of page template in current or parent template.
    684716 *
    685717 * First attempt is to look for the file in the '_wp_page_template' page meta