WordPress.org

Make WordPress Core

Changeset 40022


Ignore:
Timestamp:
01/27/17 20:30:34 (4 weeks ago)
Author:
davidakennedy
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyfourteen/functions.php

    r39226 r40022  
    546546    require get_template_directory() . '/inc/featured-content.php'; 
    547547} 
     548 
     549/** 
     550 * Add an `is_customize_preview` function if it is missing. 
     551 * 
     552 * Enables installing Twenty Fourteen in WordPress versions before 4.0.0 when the 
     553 * `is_customize_preview` function was introduced. 
     554 */ 
     555if ( ! function_exists( 'is_customize_preview' ) ) : 
     556function is_customize_preview() { 
     557    global $wp_customize; 
     558 
     559    return ( $wp_customize instanceof WP_Customize_Manager ) && $wp_customize->is_preview(); 
     560} 
     561endif; 
Note: See TracChangeset for help on using the changeset viewer.