WordPress.org

Make WordPress Core

Ticket #18331: 18331.3.patch

File 18331.3.patch, 2.1 KB (added by WraithKenny, 2 years ago)
  • wp-includes/general-template.php

     
    2424function get_header( $name = null ) { 
    2525        do_action( 'get_header', $name ); 
    2626 
    27         $templates = array(); 
    28         if ( isset($name) ) 
    29                 $templates[] = "header-{$name}.php"; 
    30  
    31         $templates[] = 'header.php'; 
    32  
    3327        // Backward compat code will be removed in a future release 
    34         if ('' == locate_template($templates, true)) 
     28        if ( '' == get_template_part( 'header', $name, true ) ) 
    3529                load_template( ABSPATH . WPINC . '/theme-compat/header.php'); 
    3630} 
    3731 
     
    5347function get_footer( $name = null ) { 
    5448        do_action( 'get_footer', $name ); 
    5549 
    56         $templates = array(); 
    57         if ( isset($name) ) 
    58                 $templates[] = "footer-{$name}.php"; 
    59  
    60         $templates[] = 'footer.php'; 
    61  
    6250        // Backward compat code will be removed in a future release 
    63         if ('' == locate_template($templates, true)) 
     51        if ( '' == get_template_part( 'footer', $name, true ) ) 
    6452                load_template( ABSPATH . WPINC . '/theme-compat/footer.php'); 
    6553} 
    6654 
     
    8270function get_sidebar( $name = null ) { 
    8371        do_action( 'get_sidebar', $name ); 
    8472 
    85         $templates = array(); 
    86         if ( isset($name) ) 
    87                 $templates[] = "sidebar-{$name}.php"; 
    88  
    89         $templates[] = 'sidebar.php'; 
    90  
    9173        // Backward compat code will be removed in a future release 
    92         if ('' == locate_template($templates, true)) 
     74        if ( '' == get_template_part( 'sidebar', $name, true ) ) 
    9375                load_template( ABSPATH . WPINC . '/theme-compat/sidebar.php'); 
    9476} 
    9577 
     
    11698 * @param string $slug The slug name for the generic template. 
    11799 * @param string $name The name of the specialised template. 
    118100 */ 
    119 function get_template_part( $slug, $name = null ) { 
     101function get_template_part( $slug, $name = null, $require_once = false ) { 
    120102        do_action( "get_template_part_{$slug}", $slug, $name ); 
    121103 
    122104        $templates = array(); 
     
    125107 
    126108        $templates[] = "{$slug}.php"; 
    127109 
    128         locate_template($templates, true, false); 
     110        locate_template($templates, true, $require_once); 
    129111} 
    130112 
    131113/**