add_panel( 'blogtay_custom_hero_slider', array( 'title' => __( 'Banner', 'blogtay' ), 'priority' => 20, // Mixed with top-level-section hierarchy. ) ); $wp_customize->add_section( 'blogtay_custom_hero_slider_section' , array( 'title' => __('Custom Banner', 'blogtay'), 'panel' => 'blogtay_custom_hero_slider', ) ); $wp_customize->add_setting( 'theme_options[hero_slider_number]', array( 'sanitize_callback' => 'absint', 'default' => 3 ) ); $wp_customize->add_control( 'theme_options[hero_slider_number]', array( 'label' => __( 'Slider item', 'blogtay'), 'description' => __( 'Enter number of slider', 'blogtay'), 'section' => 'blogtay_custom_hero_slider_section', 'type' => 'number' ) ); $options = get_theme_mod( 'theme_options' ); $number_of_slides = isset($options['hero_slider_number']) ? $options['hero_slider_number'] : 3; for( $i=1; $i <=$number_of_slides; $i++ ) { // Image $wp_customize->add_setting( 'theme_options[hero_slider_image_' .$i. ']', array( 'sanitize_callback' => 'wp_strip_all_tags' ) ); $wp_customize->add_control( new WP_Customize_Upload_Control( $wp_customize, 'theme_options[hero_slider_image_' .$i. ']', array( 'label' => __( 'Slider image ' , 'blogtay' ) . $i, 'section' => 'blogtay_custom_hero_slider_section' ) ) ); // Title $wp_customize->add_setting( 'theme_options[hero_slider_title_' .$i. ']', array( 'sanitize_callback' => 'wp_filter_nohtml_kses' ) ); $wp_customize->add_control( 'theme_options[hero_slider_title_' .$i. ']', array( 'label' => __( 'Slider Title ', 'blogtay' ) . $i, 'section' => 'blogtay_custom_hero_slider_section', 'type' => 'text' ) ); // Subtitle $wp_customize->add_setting( 'theme_options[hero_slider_subtitle_' .$i. ']', array( 'sanitize_callback' => 'wp_filter_nohtml_kses' ) ); $wp_customize->add_control( 'theme_options[hero_slider_subtitle_' .$i. ']', array( 'label' => __( 'Slider Subtitle ', 'blogtay' ) . $i, 'section' => 'blogtay_custom_hero_slider_section', 'type' => 'text' ) ); // Button_label $wp_customize->add_setting( 'theme_options[hero_slider_button_label_' .$i. ']', array( 'sanitize_callback' => 'wp_filter_nohtml_kses' ) ); $wp_customize->add_control( 'theme_options[hero_slider_button_label_' .$i. ']', array( 'label' => __( 'Slider Button Label ', 'blogtay') . $i, 'section' => 'blogtay_custom_hero_slider_section', 'type' => 'text' ) ); // Button url $wp_customize->add_setting( 'theme_options[hero_slider_button_url_' .$i. ']', array( 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( 'theme_options[hero_slider_button_url_' .$i. ']', array( 'label' => __( 'Slider Button Url ', 'blogtay' ) . $i, 'section' => 'blogtay_custom_hero_slider_section', 'type' => 'text' ) ); } // show hide banner $wp_customize->add_section( 'blogtay_banner_show_hide' , array( 'title' => __('Banner Show/Hide', 'blogtay'), 'panel' => 'blogtay_custom_hero_slider', ) ); $wp_customize->add_setting( 'theme_options[blogtay_banner_show_hide_option]', array( 'default' => 'show', 'sanitize_callback' => 'blogtay_sanitize_show_hide_section', ) ); $blogtay_show_hide_section = blogtay_show_hide_section(); $wp_customize->add_control( 'theme_options[blogtay_banner_show_hide_option]', array( 'label' => __( 'Banner section show/hide.','blogtay'), 'section' => 'blogtay_banner_show_hide', 'type' => 'radio', 'choices' => $blogtay_show_hide_section ) );