From f84ad90c1fb2e5b50c5119f7487758414209e674 Mon Sep 17 00:00:00 2001 From: "David A. Kennedy" Date: Fri, 27 Jan 2017 20:30:34 +0000 Subject: [PATCH] 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 --- src/wp-content/themes/twentyfourteen/functions.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/wp-content/themes/twentyfourteen/functions.php b/src/wp-content/themes/twentyfourteen/functions.php index 74141dc39c..b815e77e3a 100644 --- a/src/wp-content/themes/twentyfourteen/functions.php +++ b/src/wp-content/themes/twentyfourteen/functions.php @@ -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;