mirror of
https://github.com/woocommerce/storefront.git
synced 2025-08-21 04:11:59 +08:00
Apply defaults when the Customizer is open
We need to ensure these are applied when the Customizer is live because child themes can filter the values.
This commit is contained in:
parent
07b37a6faf
commit
a98ba55b12
2 changed files with 16 additions and 0 deletions
|
@ -3,6 +3,7 @@
|
|||
### *2016.05.06* - 2.0.1
|
||||
* **Fix** - Horizontal scroll bar on Safari.
|
||||
* **Fix** - Ensure the menu toggle background color updates correctly in the preview.
|
||||
* **Dev** - Apply Customizer setting defaults on `customize_register` to account for child themes filtering `storefront_setting_default_values`.
|
||||
|
||||
### *2016.05.06* - 2.0.0
|
||||
* **New** - Extensive improvements to the responsive design.
|
||||
|
|
|
@ -30,6 +30,7 @@ if ( ! class_exists( 'Storefront_Customizer' ) ) :
|
|||
add_action( 'wp_enqueue_scripts', array( $this, 'add_customizer_css' ), 130 );
|
||||
add_action( 'after_setup_theme', array( $this, 'custom_header_setup' ) );
|
||||
add_action( 'customize_controls_print_styles', array( $this, 'customizer_custom_control_css' ) );
|
||||
add_action( 'customize_register', array( $this, 'edit_default_customizer_settings' ), 99 );
|
||||
add_action( 'init', array( $this, 'default_theme_mod_values' ), 10 );
|
||||
|
||||
add_action( 'after_switch_theme', array( $this, 'set_storefront_style_theme_mods' ) );
|
||||
|
@ -76,6 +77,20 @@ if ( ! class_exists( 'Storefront_Customizer' ) ) :
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Customizer setting defaults.
|
||||
* These defaults need to be applied separately as child themes can filter storefront_setting_default_values
|
||||
*
|
||||
* @param array $wp_customize the Customizer object.
|
||||
* @uses get_storefront_default_setting_values()
|
||||
* @return void
|
||||
*/
|
||||
public function edit_default_customizer_settings( $wp_customize ) {
|
||||
foreach ( Storefront_Customizer::get_storefront_default_setting_values() as $mod => $val ) {
|
||||
$wp_customize->get_setting( $mod )->default = $val;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup the WordPress core custom header feature.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue