From 543eb608c985cc54dd078fafd510a89191bf8052 Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 19 Aug 2008 20:57:48 +0000 Subject: [PATCH] Support named headers and footers in get_footer() and get_header(). Props AaronCampbell. fixes #7549 for trunk git-svn-id: http://svn.automattic.com/wordpress/trunk@8673 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/general-template.php | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index 8bae11a472..42db416ef6 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -2,29 +2,43 @@ /* Note: these tags go anywhere in the template */ -function get_header() { +function get_header( $name = null ) { 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'); } -function get_footer() { +function get_footer( $name = null ) { 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'); } function get_sidebar( $name = null ) { do_action( 'get_sidebar' ); - + $templates = array(); if ( isset($name) ) $templates[] = "sidebar-{$name}.php"; - + $templates[] = "sidebar.php"; - + if ('' == locate_template($templates, true)) load_template( get_theme_root() . '/default/sidebar.php'); }