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.


git-svn-id: https://develop.svn.wordpress.org/trunk@40022 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
David A. Kennedy 2017-01-27 20:30:34 +00:00
parent fbbf3578b8
commit f84ad90c1f
1 changed files with 14 additions and 0 deletions

View File

@ -545,3 +545,17 @@ require get_template_directory() . '/inc/customizer.php';
if ( ! class_exists( 'Featured_Content' ) && 'plugins.php' !== $GLOBALS['pagenow'] ) { if ( ! class_exists( 'Featured_Content' ) && 'plugins.php' !== $GLOBALS['pagenow'] ) {
require get_template_directory() . '/inc/featured-content.php'; 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;