WordPress.org

Make WordPress Core

Ticket #6801: 6801.2.diff

File 6801.2.diff, 2.2 KB (added by Denis-de-Bernardy, 4 years ago)

refreshed version of westi's patch

  • wp-includes/template-loader.php

     
    2323        if     ( is_404()            && $template = get_404_template()            ) : 
    2424        elseif ( is_search()         && $template = get_search_template()         ) : 
    2525        elseif ( is_tax()            && $template = get_taxonomy_template()       ) : 
     26        elseif ( is_front_page()     && $template = get_front_page_template()     ) : 
    2627        elseif ( is_home()           && $template = get_home_template()           ) : 
    2728        elseif ( is_attachment()     && $template = get_attachment_template()     ) : 
    2829                remove_filter('the_content', 'prepend_attachment'); 
     
    4344        return; 
    4445endif; 
    4546 
    46 ?> 
    47  No newline at end of file 
     47?> 
  • wp-includes/theme.php

     
    847847} 
    848848 
    849849/** 
     850 * Retrieve path of front-page template in current or parent template. 
     851 * 
     852 * First attempt is to look for a page specific template either based on  
     853 * the '_wp_page_template' page meta, the page slug and the page id. 
     854 * The second attempt is to look for 'front-page.php' before falling back 
     855 * to 'page.php' and ultimately falling back to 'index.php' if none of 
     856 * these exist. 
     857 * 
     858 * @since 3.0.0 
     859 * @uses apply_filters() Calls 'front_page_template' on file path of template. 
     860 * 
     861 * @return string 
     862 */ 
     863function get_front_page_template() { 
     864        global $wp_query; 
     865 
     866        $templates = array(); 
     867        $templates[] = "front-page.php"; 
     868 
     869        // If we are showing a page on the front give priority to the page specific templates. 
     870        if ( 'page' == get_option('show_on_front') ) { 
     871                $templates[] = basename(get_page_template()); 
     872        } else if ( 'posts' == get_option('show_on_front') ) { 
     873                $templates[] = basename(get_home_template()); 
     874        } 
     875 
     876        return apply_filters('front_page_template', locate_template($templates)); 
     877} 
     878 
     879/** 
    850880 * Retrieve path of page template in current or parent template. 
    851881 * 
    852882 * Will first look for the specifically assigned page template