mirror of
https://github.com/woocommerce/storefront.git
synced 2025-08-21 04:11:59 +08:00
check add_partial()
exists before doing selective refresh things. closes #469
This commit is contained in:
parent
e126dff16d
commit
5eeb44399e
2 changed files with 24 additions and 20 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue