add_panel( 'bizvilla_slider_setting', array( 'priority' => 500, 'capability' => 'edit_theme_options', 'title' => __('Slider Settings', 'bizvilla'), ) ); $wp_customize->add_section( 'slider_section_settings', array( 'title' => __('Featured Slider Settings','bizvilla'), 'description' => '', 'panel' => 'bizvilla_slider_setting',) ); //Hide slider $wp_customize->add_setting( 'bizvilla_options[home_banner_enabled]', array( 'default' => '', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field', 'type' => 'option', ) ); $wp_customize->add_control( 'bizvilla_options[home_banner_enabled]', array( 'label' => __('Hide Home slider','bizvilla'), 'section' => 'slider_section_settings', 'type' => 'checkbox', ) ); //slider type $wp_customize->add_setting( 'bizvilla_options[slider_radio]', array( 'default' => 'demo', 'type' => 'option', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'bizvilla_options[slider_radio]', array( 'type' => 'radio', 'label' => __('Select Slider type','bizvilla'), 'section' => 'slider_section_settings', 'choices' => array( 'demo' => __('Demo Slider','bizvilla'), 'category' => __('Category Slider','bizvilla'), ), ) ); // add section to manage featured slider on category basis $wp_customize->add_setting( 'bizvilla_options[slider_select_category]', array( 'default' => __('Uncategorized','bizvilla'), 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bizvilla_slider_sanitize_layout', 'type'=>'option', ) ); $wp_customize->add_control( new Category_Dropdown_Custom_Control( $wp_customize, 'bizvilla_options[slider_select_category]', array( 'label' => __('Select Category for Slider','bizvilla'), 'section' => 'slider_section_settings', 'settings' => 'bizvilla_options[slider_select_category]', ) ) ); //Slider animation $wp_customize->add_setting( 'bizvilla_options[slider_options]', array( 'default' => __('slide','bizvilla'), 'type' => 'option', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'bizvilla_options[slider_options]', array( 'type' => 'select', 'label' => __('Select slider Animation','bizvilla'), 'section' => 'slider_section_settings', 'choices' => array('slide'=>__('slide', 'bizvilla'), 'carousel-fade'=>__('Fade', 'bizvilla')), )); //Slider Animation duration $wp_customize->add_setting( 'bizvilla_options[slider_transition_delay]', array( 'default' => __('2000','bizvilla'), 'type' => 'option', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control( 'bizvilla_options[slider_transition_delay]', array( 'type' => 'text', 'label' => __('Input slide Duration','bizvilla'), 'section' => 'slider_section_settings', )); //Number of slides $wp_customize->add_setting( 'bizvilla_options[featured_slider_post]', array( 'default' => __('','bizvilla'), 'sanitize_callback' => 'sanitize_text_field', 'type' => 'option', ) ); $wp_customize->add_control( 'bizvilla_options[featured_slider_post]', array( 'type' => 'text', 'label' => __('Input Number of slides','bizvilla'), 'section' => 'slider_section_settings',) ); $wp_customize->add_setting( 'bizvilla_options[slider_upgrade]', array( 'default' => false, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_filter_nohtml_kses', )); $wp_customize->add_control( new bizvilla_Customize_slider_upgrade( $wp_customize, 'bizvilla_options[slider_upgrade]', array( 'label' => __('bizvilla Upgrade','bizvilla'), 'section' => 'slider_section_settings', 'settings' => 'bizvilla_options[slider_upgrade]', ) ) ); } add_action( 'customize_register', 'bizvilla_slider_customizer' ); function bizvilla_slider_sanitize_layout( $value ) { if ( ! in_array( $value, array( 'Uncategorized','category_slider' ) ) ) return $value; } ?>