mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-29 07:37:44 +02:00
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
This commit is contained in:
parent
0348a10d49
commit
543eb608c9
@ -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');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user