reset_settings = $args[ 'settings' ]; unset( $args[ 'settings'] ); parent::__construct( $customize, $control_id, $args ); add_action( 'customize_controls_print_scripts', array( $this, 'scripts' ) ); add_action( 'wp_ajax_customizer_reset', array( $this, 'ajax_customizer_reset' ) ); $this->wp_customize = $customize; } /** * Enqueue control related scripts/styles. * * @since 1.0.0 * @access public * * @package BizSmart WordPress Theme */ public function scripts(){ wp_localize_script( BizSmart_Helper::with_prefix( 'customize-js' ), 'CUSTOMIZERRESET', array( 'nonce' => array( 'reset' => wp_create_nonce( 'customizer-reset' ), ), 'confirm' => esc_html__( 'This action is not reversible! Are you sure to reset these settings?', 'bizsmart' ) )); } /** * Adds style and button * * @since 1.0.0 * @access public * @return void * * @package BizSmart WordPress Theme */ public function render_content() { ?>
description ); ?>
wp_customize->is_preview() ) { wp_send_json_error( 'not_preview' ); } if ( ! check_ajax_referer( 'customizer-reset', 'nonce', false ) ) { wp_send_json_error( 'invalid_nonce' ); } $this->reset_settings[] = 'header_textcolor'; $this->reset_settings[] = 'background_color'; # remove theme_mod settings registered in customizer foreach ( $this->reset_settings as $setting ) { remove_theme_mod( $setting ); } wp_send_json_success(); } } endif; BizSmart_Customizer::add_custom_control( array( 'type' => 'bizsmart-reset', 'class' => 'BizSmart_Customizer_Reset', 'sanitize' => false, 'register_control_type' => false ));