mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-03 15:08:10 +01:00
In general template functions, cast to string then ensure we actually have a template name before proceeding. Affects get_sidebar(), get_header(), get_footer(), get_template_part().
props tivnet for initial patch. fixes #24714. git-svn-id: http://core.svn.wordpress.org/trunk@24616 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
35b08acc8d
commit
fb20e3b5bb
@ -25,7 +25,8 @@ function get_header( $name = null ) {
|
||||
do_action( 'get_header', $name );
|
||||
|
||||
$templates = array();
|
||||
if ( isset($name) )
|
||||
$name = (string) $name;
|
||||
if ( '' !== $name )
|
||||
$templates[] = "header-{$name}.php";
|
||||
|
||||
$templates[] = 'header.php';
|
||||
@ -54,7 +55,8 @@ function get_footer( $name = null ) {
|
||||
do_action( 'get_footer', $name );
|
||||
|
||||
$templates = array();
|
||||
if ( isset($name) )
|
||||
$name = (string) $name;
|
||||
if ( null !== $name && false !== $name )
|
||||
$templates[] = "footer-{$name}.php";
|
||||
|
||||
$templates[] = 'footer.php';
|
||||
@ -83,7 +85,8 @@ function get_sidebar( $name = null ) {
|
||||
do_action( 'get_sidebar', $name );
|
||||
|
||||
$templates = array();
|
||||
if ( isset($name) )
|
||||
$name = (string) $name;
|
||||
if ( '' !== $name )
|
||||
$templates[] = "sidebar-{$name}.php";
|
||||
|
||||
$templates[] = 'sidebar.php';
|
||||
@ -120,7 +123,8 @@ function get_template_part( $slug, $name = null ) {
|
||||
do_action( "get_template_part_{$slug}", $slug, $name );
|
||||
|
||||
$templates = array();
|
||||
if ( isset($name) )
|
||||
$name = (string) $name;
|
||||
if ( '' !== $name )
|
||||
$templates[] = "{$slug}-{$name}.php";
|
||||
|
||||
$templates[] = "{$slug}.php";
|
||||
|
Loading…
Reference in New Issue
Block a user