Use get_template_part() in get_header(), get_sidebar(), get_footer(). props scribu, see #18331.
git-svn-id: https://develop.svn.wordpress.org/trunk@18665 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
bcb073c403
commit
486670f072
@ -24,15 +24,9 @@
|
||||
function get_header( $name = null ) {
|
||||
do_action( 'get_header', $name );
|
||||
|
||||
$templates = array();
|
||||
if ( isset($name) )
|
||||
$templates[] = "header-{$name}.php";
|
||||
|
||||
$templates[] = 'header.php';
|
||||
|
||||
// Backward compat code will be removed in a future release
|
||||
if ('' == locate_template($templates, true))
|
||||
load_template( ABSPATH . WPINC . '/theme-compat/header.php');
|
||||
if ( '' == get_template_part( 'header', $name ) )
|
||||
load_template( ABSPATH . WPINC . '/theme-compat/header.php' );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -53,15 +47,9 @@ function get_header( $name = null ) {
|
||||
function get_footer( $name = null ) {
|
||||
do_action( 'get_footer', $name );
|
||||
|
||||
$templates = array();
|
||||
if ( isset($name) )
|
||||
$templates[] = "footer-{$name}.php";
|
||||
|
||||
$templates[] = 'footer.php';
|
||||
|
||||
// Backward compat code will be removed in a future release
|
||||
if ('' == locate_template($templates, true))
|
||||
load_template( ABSPATH . WPINC . '/theme-compat/footer.php');
|
||||
if ( '' == get_template_part( 'footer', $name ) )
|
||||
load_template( ABSPATH . WPINC . '/theme-compat/footer.php' );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -82,15 +70,9 @@ function get_footer( $name = null ) {
|
||||
function get_sidebar( $name = null ) {
|
||||
do_action( 'get_sidebar', $name );
|
||||
|
||||
$templates = array();
|
||||
if ( isset($name) )
|
||||
$templates[] = "sidebar-{$name}.php";
|
||||
|
||||
$templates[] = 'sidebar.php';
|
||||
|
||||
// Backward compat code will be removed in a future release
|
||||
if ('' == locate_template($templates, true))
|
||||
load_template( ABSPATH . WPINC . '/theme-compat/sidebar.php');
|
||||
if ( '' == get_template_part( 'sidebar', $name ) )
|
||||
load_template( ABSPATH . WPINC . '/theme-compat/sidebar.php' );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -125,7 +107,7 @@ function get_template_part( $slug, $name = null ) {
|
||||
|
||||
$templates[] = "{$slug}.php";
|
||||
|
||||
locate_template($templates, true, false);
|
||||
return locate_template($templates, true, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user