add_section( 'section_featured_slider', array( 'title' => __( 'Slider Section', 'business-element' ), 'priority' => 100, 'capability' => 'edit_theme_options', 'panel' => 'home_page_panel', ) ); // Enable Featured Slider Section $wp_customize->add_setting('theme_options[enable_featured_slider_section]', array( 'default' => $default['enable_featured_slider_section'], 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'business_element_sanitize_checkbox' ) ); $wp_customize->add_control('theme_options[enable_featured_slider_section]', array( 'label' => __('Enable Section', 'business-element'), 'description' => __('Go to Customize - Homepage Settings. Select A static page. Set Homepage as Home and Posts page as Blog to show this section.', 'business-element'), 'section' => 'section_featured_slider', 'settings' => 'theme_options[enable_featured_slider_section]', 'type' => 'checkbox', ) ); // Number of items $wp_customize->add_setting('theme_options[number_of_featured_slider_items]', array( 'default' => $default['number_of_featured_slider_items'], 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'business_element_sanitize_number_range' ) ); $wp_customize->add_control('theme_options[number_of_featured_slider_items]', array( 'label' => __('Number Of Items (Max: 3)', 'business-element'), 'description' => __('Click on Publish and refresh after changing the value.', 'business-element'), 'section' => 'section_featured_slider', 'settings' => 'theme_options[number_of_featured_slider_items]', 'type' => 'number', 'active_callback' => 'business_element_featured_slider_active', 'input_attrs' => array( 'min' => 1, 'max' => 3, 'step' => 1, ), ) ); $number_of_featured_slider_items = business_element_get_option( 'number_of_featured_slider_items' ); for( $i=1; $i<=$number_of_featured_slider_items; $i++ ) { // Slide Image $wp_customize->add_setting('theme_options[featured_slider_slide_image_'.$i.']', array( 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'business_element_sanitize_image' ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'theme_options[featured_slider_slide_image_'.$i.']', array( 'label' => sprintf( __('Slide Image #%1$s', 'business-element'), $i), 'section' => 'section_featured_slider', 'settings' => 'theme_options[featured_slider_slide_image_'.$i.']', 'active_callback' => 'business_element_featured_slider_active', 'type' => 'image', ) ) ); // Slide Subtitle $wp_customize->add_setting('theme_options[featured_slider_subtitle_'.$i.']', array( 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('theme_options[featured_slider_subtitle_'.$i.']', array( 'label' => sprintf( __('Subtitle #%1$s', 'business-element'), $i), 'section' => 'section_featured_slider', 'settings' => 'theme_options[featured_slider_subtitle_'.$i.']', 'active_callback' => 'business_element_featured_slider_active', 'type' => 'text' ) ); // Slide Title $wp_customize->add_setting('theme_options[featured_slider_title_'.$i.']', array( 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('theme_options[featured_slider_title_'.$i.']', array( 'label' => sprintf( __('Title #%1$s', 'business-element'), $i), 'section' => 'section_featured_slider', 'settings' => 'theme_options[featured_slider_title_'.$i.']', 'active_callback' => 'business_element_featured_slider_active', 'type' => 'text' ) ); // Slide Content $wp_customize->add_setting('theme_options[featured_slider_content_'.$i.']', array( 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'business_element_sanitize_textarea_content' ) ); $wp_customize->add_control('theme_options[featured_slider_content_'.$i.']', array( 'label' => sprintf( __('Content #%1$s', 'business-element'), $i), 'section' => 'section_featured_slider', 'settings' => 'theme_options[featured_slider_content_'.$i.']', 'active_callback' => 'business_element_featured_slider_active', 'type' => 'textarea' ) ); // Button Text One $wp_customize->add_setting('theme_options[featured_slider_btn_text_one_'.$i.']', array( 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('theme_options[featured_slider_btn_text_one_'.$i.']', array( 'label' => sprintf( __('Button Label One #%1$s', 'business-element'), $i), 'section' => 'section_featured_slider', 'settings' => 'theme_options[featured_slider_btn_text_one_'.$i.']', 'active_callback' => 'business_element_featured_slider_active', 'type' => 'text' ) ); // Button Url One $wp_customize->add_setting('theme_options[featured_slider_btn_url_one_'.$i.']', array( 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control('theme_options[featured_slider_btn_url_one_'.$i.']', array( 'label' => sprintf( __('Button Url One #%1$s', 'business-element'), $i), 'section' => 'section_featured_slider', 'settings' => 'theme_options[featured_slider_btn_url_one_'.$i.']', 'active_callback' => 'business_element_featured_slider_active', 'type' => 'url' ) ); }