add_section( 'business_center_pro_testimonial_section', array( 'title' => esc_html__( 'Testimonial Options','business-center-pro' ), 'description' => esc_html__( 'Testimonial options.', 'business-center-pro' ), 'panel' => 'business_center_pro_sections_panel', ) ); /** * Testimonial Options */ // Enable testimonial. $wp_customize->add_setting( 'business_center_pro_theme_options[enable_testimonial]', array( 'default' => $options['enable_testimonial'], 'sanitize_callback' => 'business_center_pro_sanitize_checkbox', ) ); $wp_customize->add_control( 'business_center_pro_theme_options[enable_testimonial]', array( 'label' => esc_html__( 'Enable Testimonial Section?', 'business-center-pro' ), 'section' => 'business_center_pro_testimonial_section', 'type' => 'checkbox' ) ); // Testimonial title. $wp_customize->add_setting( 'business_center_pro_theme_options[testimonial_title]', array( 'default' => $options['testimonial_title'], 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'business_center_pro_theme_options[testimonial_title]', array( 'active_callback' => 'business_center_pro_is_testimonial_enable', 'label' => esc_html__( 'Title:', 'business-center-pro' ), 'section' => 'business_center_pro_testimonial_section', 'type' => 'text' ) ); // Abort if selective refresh is not available. if ( isset( $wp_customize->selective_refresh ) ) { $wp_customize->selective_refresh->add_partial( 'business_center_pro_theme_options[testimonial_title]', array( 'selector' => '#client-testimonial-slider .entry-header .entry-title', 'render_callback' => 'business_center_pro_partial_testimonial_title', 'container_inclusive' => false, 'fallback_refresh' => true, ) ); } // Testimonial sub-title. $wp_customize->add_setting( 'business_center_pro_theme_options[testimonial_sub_title]', array( 'default' => $options['testimonial_sub_title'], 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'business_center_pro_theme_options[testimonial_sub_title]', array( 'active_callback' => 'business_center_pro_is_testimonial_enable', 'label' => esc_html__( 'Sub Title:', 'business-center-pro' ), 'section' => 'business_center_pro_testimonial_section', 'type' => 'text' ) ); // Abort if selective refresh is not available. if ( isset( $wp_customize->selective_refresh ) ) { $wp_customize->selective_refresh->add_partial( 'business_center_pro_theme_options[testimonial_sub_title]', array( 'selector' => '#client-testimonial-slider .entry-header .subtitle', 'render_callback' => 'business_center_pro_partial_testimonial_sub_title', 'container_inclusive' => false, 'fallback_refresh' => true, ) ); } /** * Testimonial content type options. */ $wp_customize->add_setting( 'business_center_pro_theme_options[testimonial_content_type]', array( 'default' => $options['testimonial_content_type'], 'sanitize_callback' => 'business_center_pro_sanitize_select', ) ); $wp_customize->add_control( 'business_center_pro_theme_options[testimonial_content_type]', array( 'active_callback' => 'business_center_pro_is_testimonial_enable', 'label' => esc_html__( 'Content Type', 'business-center-pro' ), 'section' => 'business_center_pro_testimonial_section', 'choices' => business_center_pro_testimonial_content_type_options(), 'type' => 'select' ) ); // Number of testimonials. $wp_customize->add_setting( 'business_center_pro_theme_options[number_of_testimonials]', array( 'default' => $options['number_of_testimonials'], 'sanitize_callback' => 'business_center_pro_sanitize_number_range', ) ); $wp_customize->add_control( 'business_center_pro_theme_options[number_of_testimonials]', array( 'active_callback' => 'business_center_pro_is_testimonial_demo_disable', 'label' => esc_html__( 'Number of testimonials? ( Max: 5 )', 'business-center-pro' ), 'description' => esc_html__( 'Note: Please refresh after changing the value to see the changes.', 'business-center-pro' ), 'section' => 'business_center_pro_testimonial_section', 'input_attrs' => array( 'min' => 1, 'max' => 5 ), 'type' => 'number' ) ); for ( $i=1; $i <= $options['number_of_testimonials']; $i++ ) { /** * Custom Content Type Options */ // Testimonial title Options $wp_customize->add_setting( 'business_center_pro_theme_options[custom_testimonial_title_company_'.$i.']', array( 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'business_center_pro_theme_options[custom_testimonial_title_company_'.$i.']', array( 'active_callback' => 'business_center_pro_is_testimonial_content_type_custom_enable', 'label' => esc_html__( 'Client Name / Company ', 'business-center-pro' ) . $i, 'section' => 'business_center_pro_testimonial_section', 'type' => 'text', ) ); // Testimonial url Options $wp_customize->add_setting( 'business_center_pro_theme_options[custom_testimonial_url_'.$i.']', array( 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( 'business_center_pro_theme_options[custom_testimonial_url_'.$i.']', array( 'active_callback' => 'business_center_pro_is_testimonial_content_type_custom_enable', 'label' => esc_html__( 'Client URL ', 'business-center-pro' ) . $i, 'section' => 'business_center_pro_testimonial_section', 'type' => 'url', ) ); // Testimonial avatar options $wp_customize->add_setting( 'business_center_pro_theme_options[custom_testimonial_avatar_'.$i.']', array( 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'business_center_pro_theme_options[custom_testimonial_avatar_'.$i.']', array( 'active_callback' => 'business_center_pro_is_testimonial_content_type_custom_enable', 'label' => esc_html__( 'Client Avatar ', 'business-center-pro' ) . $i, 'description' => esc_html__( 'The recommended size for the image is 100px by 100px. ', 'business-center-pro' ), 'section' => 'business_center_pro_testimonial_section', ) ) ); // Testimonial info Options $wp_customize->add_setting( 'business_center_pro_theme_options[custom_testimonial_content_'.$i.']', array( 'sanitize_callback' => 'esc_textarea' ) ); $wp_customize->add_control( 'business_center_pro_theme_options[custom_testimonial_content_'.$i.']', array( 'active_callback' => 'business_center_pro_is_testimonial_content_type_custom_enable', 'label' => esc_html__( 'Client Info ', 'business-center-pro' ) . $i, 'section' => 'business_center_pro_testimonial_section', 'type' => 'textarea', ) ); // Horizontal Line $wp_customize->add_setting( 'business_center_pro_theme_options[testimonial_content_type_hr' . $i . ']', array( 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( new Business_Center_Pro_Customize_Horizontal_Line( $wp_customize, 'business_center_pro_theme_options[testimonial_content_type_hr' . $i . ']', array( 'active_callback' => 'business_center_pro_is_testimonial_content_type_custom_enable', 'section' => 'business_center_pro_testimonial_section', 'type' => 'hr', ) ) ); } /** * Category Content Type Options */ // Catgegory Options $wp_customize->add_setting( 'business_center_pro_theme_options[testimonial_category]', array( 'sanitize_callback' => 'business_center_pro_sanitize_tax_checkbox' ) ); $wp_customize->add_control( new Business_Center_Pro_Customize_Control_Checkbox_Multiple( $wp_customize, 'business_center_pro_theme_options[testimonial_category]', array( 'active_callback' => 'business_center_pro_is_testimonial_content_type_category_enable', 'label' => esc_html__( 'Select Category', 'business-center-pro' ), 'section' => 'business_center_pro_testimonial_section', 'type' => 'checkbox-multiple', 'taxonomy' => 'category', ) ) );