Twenty Fourteen: Fix fatal errors in WordPress versions before 4.0.0

The line of code throwing the error was introduced in WordPress 4.5 in r37040 "Customize: Require opt-in for selective refresh of widgets". Since `is_customize_preview()` was introduced in 4.0.0 and Twenty Fourteen should work from WordPress 3.6 and up, this caused the issue.

The patch adds an `is_customize_preview` function if it's missing.

Props adamsilverstein.

Fixes #39407.

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


git-svn-id: http://core.svn.wordpress.org/trunk@39959 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
David A. Kennedy 2017-01-27 20:31:42 +00:00
parent 4ca4ff999a
commit bccec366ca
2 changed files with 15 additions and 1 deletions

View File

@ -545,3 +545,17 @@ require get_template_directory() . '/inc/customizer.php';
if ( ! class_exists( 'Featured_Content' ) && 'plugins.php' !== $GLOBALS['pagenow'] ) {
require get_template_directory() . '/inc/featured-content.php';
}
/**
* Add an `is_customize_preview` function if it is missing.
*
* Enables installing Twenty Fourteen in WordPress versions before 4.0.0 when the
* `is_customize_preview` function was introduced.
*/
if ( ! function_exists( 'is_customize_preview' ) ) :
function is_customize_preview() {
global $wp_customize;
return ( $wp_customize instanceof WP_Customize_Manager ) && $wp_customize->is_preview();
}
endif;

View File

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