Support named headers and footers in get_footer() and get_header(). Props AaronCampbell. fixes #7549 for trunk

git-svn-id: https://develop.svn.wordpress.org/trunk@8673 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2008-08-19 20:57:48 +00:00
parent 8027eb1ca6
commit d93d32ae99
1 changed files with 21 additions and 7 deletions

View File

@ -2,16 +2,30 @@
/* Note: these tags go anywhere in the template */ /* Note: these tags go anywhere in the template */
function get_header() { function get_header( $name = null ) {
do_action( 'get_header' ); do_action( 'get_header' );
if ('' == locate_template(array('header.php'), true))
$templates = array();
if ( isset($name) )
$templates[] = "header-{$name}.php";
$templates[] = "header.php";
if ('' == locate_template($templates, true))
load_template( get_theme_root() . '/default/header.php'); load_template( get_theme_root() . '/default/header.php');
} }
function get_footer() { function get_footer( $name = null ) {
do_action( 'get_footer' ); do_action( 'get_footer' );
if ('' == locate_template(array('footer.php'), true))
$templates = array();
if ( isset($name) )
$templates[] = "footer-{$name}.php";
$templates[] = "footer.php";
if ('' == locate_template($templates, true))
load_template( get_theme_root() . '/default/footer.php'); load_template( get_theme_root() . '/default/footer.php');
} }