selective_refresh ) ? 'postMessage' : 'refresh'; class Busihub_Banner_Toggle_Switch_Custom_control extends WP_Customize_Control { /** * The type of control being rendered */ public $type = 'toogle_switch'; /** * Enqueue our scripts and styles */ /** * Render the control in the customizer */ public function render_content(){ ?>
link(); checked( $this->value() ); ?>>
label ); ?> description ) ) { ?> description ); ?>
add_section( 'banner_page_section' , array( 'title' => __('Banner setting', 'busihub'), 'priority' => 30, ) ); $wp_customize->add_setting( 'busihub_banner_enabled', array( 'default' => 1, 'transport' => 'refresh', 'sanitize_callback' => 'busihub_banner_switch_sanitization' ) ); $wp_customize->add_control( new Busihub_Banner_Toggle_Switch_Custom_control( $wp_customize, 'busihub_banner_enabled', array( 'label' => esc_html__( 'Hide banner section from all pages','busihub' ), 'section' => 'banner_page_section' ) ) ); } add_action('customize_register','busihub_banner_section_setting'); if ( ! function_exists( 'busihub_banner_switch_sanitization' ) ) { function busihub_banner_switch_sanitization( $input ) { if ( true === $input ) { return 1; } else { return 0; } } } ?>