add_section('balen_testimonial_section', array( 'title' => esc_html__('Testimonials', 'balen'), 'description' => esc_html__('Testimonials Section options.', 'balen'), 'panel' => 'balen_front_page_panel', ) ); // Testimonials content enable control and setting $wp_customize->add_setting('balen_theme_options[testimonial_section_enable]', array( 'default' => $options['testimonial_section_enable'], 'sanitize_callback' => 'balen_sanitize_switch_control', ) ); $wp_customize->add_control(new Balen_Switch_Control($wp_customize, 'balen_theme_options[testimonial_section_enable]', array( 'label' => esc_html__('Testimonials Section Enable', 'balen'), 'section' => 'balen_testimonial_section', 'on_off_label' => balen_switch_options(), ) ) ); // testimonial title setting and control $wp_customize->add_setting( 'balen_theme_options[testimonial_subtitle]', array( 'sanitize_callback' => 'sanitize_text_field', 'default' => $options['testimonial_subtitle'], 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'balen_theme_options[testimonial_subtitle]', array( 'label' => esc_html__( 'Seciton Sub Title', 'balen' ), 'section' => 'balen_testimonial_section', 'active_callback' => 'balen_is_testimonial_section_enable', 'type' => 'text', ) ); // Abort if selective refresh is not available. if ( isset( $wp_customize->selective_refresh ) ) { $wp_customize->selective_refresh->add_partial( 'balen_theme_options[testimonial_subtitle]', array( 'selector' => '#balen_testimonial_section p.section-subtitle', 'settings' => 'balen_theme_options[testimonial_subtitle]', 'container_inclusive' => false, 'fallback_refresh' => true, 'render_callback' => 'balen_testimonial_subtitle_partial', ) ); } // testimonial title setting and control $wp_customize->add_setting( 'balen_theme_options[testimonial_title]', array( 'sanitize_callback' => 'sanitize_text_field', 'default' => $options['testimonial_title'], 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'balen_theme_options[testimonial_title]', array( 'label' => esc_html__( 'Section Title', 'balen' ), 'section' => 'balen_testimonial_section', 'active_callback' => 'balen_is_testimonial_section_enable', 'type' => 'text', ) ); // Abort if selective refresh is not available. if ( isset( $wp_customize->selective_refresh ) ) { $wp_customize->selective_refresh->add_partial( 'balen_theme_options[testimonial_title]', array( 'selector' => '#balen_testimonial_section h2.section-title', 'settings' => 'balen_theme_options[testimonial_title]', 'container_inclusive' => false, 'fallback_refresh' => true, 'render_callback' => 'balen_testimonial_title_partial', ) ); } $wp_customize->add_setting( 'balen_theme_options[testimonial_image]', array( 'sanitize_callback' => 'balen_sanitize_image', ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'balen_theme_options[testimonial_image]', array( 'label' => esc_html__( 'Background Image', 'balen' ), 'description' => sprintf( esc_html__( 'Recommended size: %1$dpx x %2$dpx ', 'balen' ), 1350, 385 ), 'section' => 'balen_testimonial_section', 'active_callback' => 'balen_is_testimonial_section_enable', ) ) ); for ($i = 1; $i <= $options['testimonial_posts_count']; $i++): // Testimonials posts drop down chooser control and setting $wp_customize->add_setting('balen_theme_options[testimonial_content_post_' . $i . ']', array( 'sanitize_callback' => 'balen_sanitize_page', ) ); $wp_customize->add_control(new Balen_Dropdown_Chooser($wp_customize, 'balen_theme_options[testimonial_content_post_' . $i . ']', array( 'label' => sprintf(esc_html__('Select Post : %d', 'balen'), $i), 'section' => 'balen_testimonial_section', 'choices' => balen_post_choices(), 'active_callback' => 'balen_is_testimonial_section_enable', ) ) ); // Testimonial posts sub title control and setting $wp_customize->add_setting('balen_theme_options[testimonial_post_designation_' . $i . ']', array( 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control(new Balen_Dropdown_Chooser($wp_customize, 'balen_theme_options[testimonial_post_designation_' . $i . ']', array( 'label' => sprintf(esc_html__('Select Designation : %d', 'balen'), $i), 'section' => 'balen_testimonial_section', 'active_callback' => 'balen_is_testimonial_section_enable', 'type' => 'text', ) ) ); //testimonial separator $wp_customize->add_setting('balen_theme_options[testimonial_separator'. $i .']', array( 'sanitize_callback' => 'balen_sanitize_html', ) ); $wp_customize->add_control(new Balen_Customize_Horizontal_Line($wp_customize, 'balen_theme_options[testimonial_separator'. $i .']', array( 'active_callback' => 'balen_is_testimonial_section_enable', 'type' =>'hr', 'section' =>'balen_testimonial_section', ) ) ); endfor;