Allow `is_page_template()` to accept an array, as many other conditional tags do.

props morganestes, tyxla, DrewAPicture.
fixes #31271.

Built from https://develop.svn.wordpress.org/trunk@31754


git-svn-id: http://core.svn.wordpress.org/trunk@31735 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Helen Hou-Sandí 2015-03-12 16:28:27 +00:00
parent 5c9656393a
commit 798abe9f78
2 changed files with 13 additions and 4 deletions

View File

@ -1629,12 +1629,13 @@ function get_the_password_form( $post = 0 ) {
* Whether currently in a page template.
*
* This template tag allows you to determine if you are in a page template.
* You can optionally provide a template name and then the check will be
* specific to that template.
* You can optionally provide a template name or array of template names
* and then the check will be specific to that template.
*
* @since 2.5.0
* @since 4.2.0 The `$template` parameter was changed to accept an array of page templates.
*
* @param string $template The specific template name if specific matching is required.
* @param string|array $template The specific template name or array of templates to match.
* @return bool True on success, false on failure.
*/
function is_page_template( $template = '' ) {
@ -1649,6 +1650,14 @@ function is_page_template( $template = '' ) {
if ( $template == $page_template )
return true;
if ( is_array( $template ) ) {
if ( ( in_array( 'default', $template, true ) && ! $page_template )
|| in_array( $page_template, $template, true )
) {
return true;
}
}
if ( 'default' == $template && ! $page_template )
return true;

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.2-alpha-31753';
$wp_version = '4.2-alpha-31754';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.