Make WordPress Core

Ticket #6801: 6801.006.diff

File 6801.006.diff, 2.4 KB (added by aaroncampbell, 17 years ago)
  • trunk/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?>
  • trunk/wp-includes/theme.php

     
    667667/**
    668668 * Retrieve path of home template in current or parent template.
    669669 *
    670  * Attempts to locate 'home.php' first before falling back to 'index.php'.
     670 * Attempts to locate 'home.php'.
    671671 *
    672672 * @since 1.5.0
    673673 * @uses apply_filters() Calls 'home_template' on file path of home template.
     
    675675 * @return string
    676676 */
    677677function get_home_template() {
    678         $template = locate_template(array('home.php', 'index.php'));
     678        $template = locate_template(array('home.php'));
    679679        return apply_filters('home_template', $template);
    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'.
     688 *
     689 * @since 2.9.0
     690 * @uses apply_filters() Calls 'front_page_template' on file path of template.
     691 *
     692 * @return string
     693 */
     694function get_front_page_template() {
     695        global $wp_query;
     696
     697        $id = (int) $wp_query->post->ID;
     698        $template = get_post_meta($id, '_wp_page_template', true);
     699
     700        if ( 'default' == $template )
     701                $template = '';
     702
     703        $templates = array();
     704        if ( !empty($template) && !validate_file($template) )
     705                $templates[] = $template;
     706
     707        $templates[] = "front-page.php";
     708        $templates[] = "page.php";
     709
     710        return apply_filters('front_page_template', locate_template($templates));
     711}
     712
     713/**
    683714 * Retrieve path of page template in current or parent template.
    684715 *
    685716 * First attempt is to look for the file in the '_wp_page_template' page meta