add_section( 'business_center_pro_feature_section', array( 'title' => esc_html__( 'Feature Options','business-center-pro' ), 'description' => esc_html__( 'The recommended size for the image is 500px by 375px or 4:3 ratio. ', 'business-center-pro' ), 'panel' => 'business_center_pro_sections_panel', ) ); /** * Feature Options */ // Enable service. $wp_customize->add_setting( 'business_center_pro_theme_options[enable_feature]', array( 'default' => $options['enable_feature'], 'sanitize_callback' => 'business_center_pro_sanitize_checkbox', ) ); $wp_customize->add_control( 'business_center_pro_theme_options[enable_feature]', array( 'label' => esc_html__( 'Enable Feature Section?', 'business-center-pro' ), 'section' => 'business_center_pro_feature_section', 'type' => 'checkbox' ) ); /** * Feature content type options. */ $wp_customize->add_setting( 'business_center_pro_theme_options[feature_content_type]', array( 'default' => $options['feature_content_type'], 'sanitize_callback' => 'business_center_pro_sanitize_select', ) ); $wp_customize->add_control( 'business_center_pro_theme_options[feature_content_type]', array( 'active_callback' => 'business_center_pro_is_feature_enable', 'label' => esc_html__( 'Content Type', 'business-center-pro' ), 'section' => 'business_center_pro_feature_section', 'choices' => business_center_pro_feature_content_type_options(), 'type' => 'select' ) ); // Nubmer of slider. $wp_customize->add_setting( 'business_center_pro_theme_options[number_of_features]', array( 'default' => $options['number_of_features'], 'sanitize_callback' => 'business_center_pro_sanitize_number_range', ) ); $wp_customize->add_control( 'business_center_pro_theme_options[number_of_features]', array( 'active_callback' => 'business_center_pro_is_feature_demo_disable', 'label' => esc_html__( 'Number of features? ( 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_feature_section', 'input_attrs' => array( 'min' => 1, 'max' => 5 ), 'type' => 'number' ) ); // View more button text. $wp_customize->add_setting( 'business_center_pro_theme_options[custom_feature_view_more_text]', array( 'default' => $options['custom_feature_view_more_text'], 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'business_center_pro_theme_options[custom_feature_view_more_text]', array( 'active_callback' => 'business_center_pro_is_feature_demo_disable', 'label' => esc_html__( 'View More Text: ', 'business-center-pro' ), 'section' => 'business_center_pro_feature_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[custom_feature_view_more_text]', array( 'selector' => '#features .entry-content .view-more', 'render_callback' => 'business_center_pro_partial_feature_view_more_text', 'container_inclusive' => false, 'fallback_refresh' => true, ) ); } // View more button link. $wp_customize->add_setting( 'business_center_pro_theme_options[custom_feature_view_more_link]', array( 'default' => $options['custom_feature_view_more_link'], 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( 'business_center_pro_theme_options[custom_feature_view_more_link]', array( 'active_callback' => 'business_center_pro_is_feature_demo_disable', 'label' => esc_html__( 'View More Link: ', 'business-center-pro' ), 'section' => 'business_center_pro_feature_section', 'type' => 'url' ) ); // Icon Options $wp_customize->add_setting( 'business_center_pro_theme_options[feature_icon_type]', array( 'sanitize_callback' => 'business_center_pro_sanitize_select' ) ); $wp_customize->add_control( 'business_center_pro_theme_options[feature_icon_type]', array( 'active_callback' => 'business_center_pro_is_feature_content_type_custom_category_enable', 'label' => esc_html__( 'Icon Type: ', 'business-center-pro' ), 'section' => 'business_center_pro_feature_section', 'type' => 'select', 'choices' => array( 'fa-icon' => esc_html__( 'FA Icon', 'business-center-pro' ), 'img-icon' => esc_html__( 'Icon Image', 'business-center-pro' ) ) ) ); for ( $i=1; $i <= $options['number_of_features']; $i++ ) { /** * Custom Content Type Options */ // Title Options $wp_customize->add_setting( 'business_center_pro_theme_options[custom_feature_title_'.$i.']', array( 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'business_center_pro_theme_options[custom_feature_title_'.$i.']', array( 'active_callback' => 'business_center_pro_is_feature_content_type_custom_enable', 'label' => esc_html__( 'Title ', 'business-center-pro' ) . $i, 'section' => 'business_center_pro_feature_section', 'type' => 'text', ) ); // Featured image Options $wp_customize->add_setting( 'business_center_pro_theme_options[custom_feature_image_'.$i.']', array( 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'business_center_pro_theme_options[custom_feature_image_'.$i.']', array( 'active_callback' => 'business_center_pro_is_feature_content_type_custom_enable', 'label' => esc_html__( 'Featured Image ', 'business-center-pro' ) . $i, 'description' => esc_html__( 'The recommended size is 500px by 375px. ', 'business-center-pro' ), 'section' => 'business_center_pro_feature_section', ) ) ); // FA Icon Options $wp_customize->add_setting( 'business_center_pro_theme_options[feature_fa_icon_'.$i.']', array( 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'business_center_pro_theme_options[feature_fa_icon_'.$i.']', array( 'active_callback' => 'business_center_pro_is_feature_content_type_custom_fa_icon_enable', 'label' => esc_html__( 'FA Icon ', 'business-center-pro' ) . $i, 'section' => 'business_center_pro_feature_section', 'type' => 'text', 'input_attrs' => array( 'placeholder' => esc_attr__( 'fa-archive', 'business-center-pro' ) ) ) ); // Image Icon Options $wp_customize->add_setting( 'business_center_pro_theme_options[feature_image_icon_'.$i.']', array( 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'business_center_pro_theme_options[feature_image_icon_'.$i.']', array( 'active_callback' => 'business_center_pro_is_feature_content_type_custom_image_icon_enable', 'label' => esc_html__( 'Image Icon ', 'business-center-pro' ) . $i, 'description' => esc_html__( 'The recommended size is 50px by 50px. ', 'business-center-pro' ), 'section' => 'business_center_pro_feature_section', ) ) ); // Link Options $wp_customize->add_setting( 'business_center_pro_theme_options[custom_feature_link_'.$i.']', array( 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( 'business_center_pro_theme_options[custom_feature_link_'.$i.']', array( 'active_callback' => 'business_center_pro_is_feature_content_type_custom_enable', 'label' => esc_html__( 'Link ', 'business-center-pro' ) . $i, 'section' => 'business_center_pro_feature_section', 'type' => 'url' ) ); // Horizontal Line $wp_customize->add_setting( 'business_center_pro_theme_options[feature_custom_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[feature_custom_hr_' . $i . ']', array( 'active_callback' => 'business_center_pro_is_feature_content_type_custom_enable', 'section' => 'business_center_pro_feature_section', 'type' => 'hr', ) ) ); } /** * Category Content Type Options */ // Catgegory Options $wp_customize->add_setting( 'business_center_pro_theme_options[feature_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[feature_category]', array( 'active_callback' => 'business_center_pro_is_feature_content_type_category_enable', 'label' => esc_html__( 'Select Category', 'business-center-pro' ), 'section' => 'business_center_pro_feature_section', 'type' => 'checkbox-multiple', 'taxonomy' => 'category', ) ) );