check add_partial() exists before doing selective refresh things. closes #469

This commit is contained in:
James Koster 2016-09-08 10:58:17 +01:00
parent e126dff16d
commit 5eeb44399e
2 changed files with 24 additions and 20 deletions

View file

@ -1,6 +1,7 @@
# Storefront Changelog
### *2016.xx.xx* - 2.1.2
* **Fix** - Fatal errors in the Customizer when using older versions of WordPress.
* **Dev** - Tweaked how Customizer defaults are set so that checkboxes will work.
### *2016.09.02* - 2.1.1

View file

@ -131,8 +131,6 @@ if ( ! class_exists( 'Storefront_Customizer' ) ) :
* @since 1.0.0
*/
public function customize_register( $wp_customize ) {
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
// Move background color setting alongside background image.
$wp_customize->get_control( 'background_color' )->section = 'background_image';
@ -147,26 +145,31 @@ if ( ! class_exists( 'Storefront_Customizer' ) ) :
$wp_customize->get_section( 'header_image' )->priority = 25;
// Selective refresh.
$wp_customize->selective_refresh->add_partial( 'custom_logo', array(
'selector' => '.site-branding',
'render_callback' => function() {
storefront_site_title_or_logo();
},
) );
if ( function_exists( 'add_partial' ) ) {
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
$wp_customize->selective_refresh->add_partial( 'blogname', array(
'selector' => '.site-title.beta a',
'render_callback' => function() {
bloginfo( 'name' );
},
) );
$wp_customize->selective_refresh->add_partial( 'custom_logo', array(
'selector' => '.site-branding',
'render_callback' => function() {
storefront_site_title_or_logo();
},
) );
$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
'selector' => '.site-description',
'render_callback' => function() {
bloginfo( 'description' );
},
) );
$wp_customize->selective_refresh->add_partial( 'blogname', array(
'selector' => '.site-title.beta a',
'render_callback' => function() {
bloginfo( 'name' );
},
) );
$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
'selector' => '.site-description',
'render_callback' => function() {
bloginfo( 'description' );
},
) );
}
/**
* Custom controls