Reset Button
-
I’m using this function to reset all my theme mode to it’s default.
remove_theme_mods();
// Re-create all the default settings.
foreach ($defaults as $key => $value) {
$wp_customize->add_setting( $key , array( ‘default’ => $value ) );
}I used this function and pasted it on to my customizer.php just above my add_action( ‘customize_register’, ‘AC_register_theme_customizer’ ); line. The way it’s working now is that when I change stuff in the customizer and save all my changes are saved, but when I reopen the customizer all the settings go back to the default.
I want to make another section in the customizing menu to give users an option to reset all options if you choose this. How do I do that??
I added another section called reset and tried hooking it with the above code and just got an error:
$wp_customize->add_section( ‘AC_reset’ , array(
‘title’ => __(‘Reset’,’AC’),
‘priority’ => 100,
) );remove_theme_mods();
foreach ($defaults as $key => $value) {
$wp_customize->add_setting( ‘Reset’, $key , array( ‘default’ => $value ) );
}Thank-you,
Dewi Tjin
- The topic ‘Reset Button’ is closed to new replies.