Make WordPress Core

Changeset 18665


Ignore:
Timestamp:
09/13/2011 04:17:14 PM (14 years ago)
Author:
nacin
Message:

Use get_template_part() in get_header(), get_sidebar(), get_footer(). props scribu, see #18331.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/general-template.php

    r18519 r18665  
    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))
    35         load_template( ABSPATH . WPINC . '/theme-compat/header.php');
     28    if ( '' == get_template_part( 'header', $name ) )
     29        load_template( ABSPATH . WPINC . '/theme-compat/header.php' );
    3630}
    3731
     
    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))
    64         load_template( ABSPATH . WPINC . '/theme-compat/footer.php');
     51    if ( '' == get_template_part( 'footer', $name ) )
     52        load_template( ABSPATH . WPINC . '/theme-compat/footer.php' );
    6553}
    6654
     
    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))
    93         load_template( ABSPATH . WPINC . '/theme-compat/sidebar.php');
     74    if ( '' == get_template_part( 'sidebar', $name ) )
     75        load_template( ABSPATH . WPINC . '/theme-compat/sidebar.php' );
    9476}
    9577
     
    126108    $templates[] = "{$slug}.php";
    127109
    128     locate_template($templates, true, false);
     110    return locate_template($templates, true, false);
    129111}
    130112
Note: See TracChangeset for help on using the changeset viewer.