From bccec366ca24a7d5a915935a9bb4d1576285cd9e Mon Sep 17 00:00:00 2001 From: "David A. Kennedy" Date: Fri, 27 Jan 2017 20:31:42 +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. Built from https://develop.svn.wordpress.org/trunk@40022 git-svn-id: http://core.svn.wordpress.org/trunk@39959 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-content/themes/twentyfourteen/functions.php | 14 ++++++++++++++ wp-includes/version.php | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/wp-content/themes/twentyfourteen/functions.php b/wp-content/themes/twentyfourteen/functions.php index 74141dc39c..b815e77e3a 100644 --- a/wp-content/themes/twentyfourteen/functions.php +++ b/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; diff --git a/wp-includes/version.php b/wp-includes/version.php index d2abbe9f36..d2fc2db28a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.