add_section( 'business_center_pro_service_section', array( 'title' => esc_html__( 'Service Options','business-center-pro' ), 'description' => esc_html__( 'Service options.', 'business-center-pro' ), 'panel' => 'business_center_pro_sections_panel', ) ); /** * Service Options */ // Enable service. $wp_customize->add_setting( 'business_center_pro_theme_options[enable_service]', array( 'default' => $options['enable_service'], 'sanitize_callback' => 'business_center_pro_sanitize_checkbox', ) ); $wp_customize->add_control( 'business_center_pro_theme_options[enable_service]', array( 'label' => esc_html__( 'Enable Service Section?', 'business-center-pro' ), 'section' => 'business_center_pro_service_section', 'type' => 'checkbox' ) ); /** * Service Options */ // Service title. $wp_customize->add_setting( 'business_center_pro_theme_options[service_title]', array( 'default' => $options['service_title'], 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'business_center_pro_theme_options[service_title]', array( 'active_callback' => 'business_center_pro_is_service_enable', 'label' => esc_html__( 'Title:', 'business-center-pro' ), 'section' => 'business_center_pro_service_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[service_title]', array( 'selector' => '#services .entry-header .entry-title', 'render_callback' => 'business_center_pro_partial_service_title', 'container_inclusive' => false, 'fallback_refresh' => true, ) ); } // Service sub-title. $wp_customize->add_setting( 'business_center_pro_theme_options[service_sub_title]', array( 'default' => $options['service_sub_title'], 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'business_center_pro_theme_options[service_sub_title]', array( 'active_callback' => 'business_center_pro_is_service_enable', 'label' => esc_html__( 'Sub Title:', 'business-center-pro' ), 'section' => 'business_center_pro_service_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[service_sub_title]', array( 'selector' => '#services .entry-header .subtitle', 'render_callback' => 'business_center_pro_partial_service_sub_title', 'container_inclusive' => false, 'fallback_refresh' => true, ) ); } /** * Service content type options. */ $wp_customize->add_setting( 'business_center_pro_theme_options[service_content_type]', array( 'default' => $options['service_content_type'], 'sanitize_callback' => 'business_center_pro_sanitize_select', ) ); $wp_customize->add_control( 'business_center_pro_theme_options[service_content_type]', array( 'active_callback' => 'business_center_pro_is_service_enable', 'label' => esc_html__( 'Content Type', 'business-center-pro' ), 'section' => 'business_center_pro_service_section', 'choices' => business_center_pro_service_content_type_options(), 'type' => 'select' ) ); // Number of services. $wp_customize->add_setting( 'business_center_pro_theme_options[number_of_services]', array( 'default' => $options['number_of_services'], 'sanitize_callback' => 'business_center_pro_sanitize_number_range', ) ); $wp_customize->add_control( 'business_center_pro_theme_options[number_of_services]', array( 'active_callback' => 'business_center_pro_is_service_demo_disable', 'label' => esc_html__( 'Number of services? ( Max: 6 )', 'business-center-pro' ), 'description' => esc_html__( 'Note: Please refresh after changing the value to see the changes.', 'business-center-pro' ), 'section' => 'business_center_pro_service_section', 'input_attrs' => array( 'min' => 1, 'max' => 6 ), 'type' => 'number' ) ); for ( $i=1; $i <= $options['number_of_services']; $i++ ) { /** * Custom Content Type Options */ // Service title Options $wp_customize->add_setting( 'business_center_pro_theme_options[custom_service_title_'.$i.']', array( 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'business_center_pro_theme_options[custom_service_title_'.$i.']', array( 'active_callback' => 'business_center_pro_is_service_content_type_custom_enable', 'label' => esc_html__( 'Service Title ', 'business-center-pro' ) . $i, 'section' => 'business_center_pro_service_section', 'type' => 'text', ) ); // Service link Options $wp_customize->add_setting( 'business_center_pro_theme_options[custom_service_link_'.$i.']', array( 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( 'business_center_pro_theme_options[custom_service_link_'.$i.']', array( 'active_callback' => 'business_center_pro_is_service_content_type_custom_enable', 'label' => esc_html__( 'Service Title Link ', 'business-center-pro' ) . $i, 'section' => 'business_center_pro_service_section', 'type' => 'url', ) ); // Service sub title Options $wp_customize->add_setting( 'business_center_pro_theme_options[custom_service_sub_title_'.$i.']', array( 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'business_center_pro_theme_options[custom_service_sub_title_'.$i.']', array( 'active_callback' => 'business_center_pro_is_service_content_type_custom_enable', 'label' => esc_html__( 'Service Sub Title ', 'business-center-pro' ) . $i, 'section' => 'business_center_pro_service_section', 'type' => 'text', ) ); // Service icon Options $wp_customize->add_setting( 'business_center_pro_theme_options[custom_service_icon_'.$i.']', array( 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'business_center_pro_theme_options[custom_service_icon_'.$i.']', array( 'active_callback' => 'business_center_pro_is_service_content_type_category_or_custom_enable', 'label' => esc_html__( 'Service Icon ', 'business-center-pro' ) . $i, 'section' => 'business_center_pro_service_section', 'type' => 'text', 'input_attrs' => array( 'placeholder' => esc_attr__( 'fa-archive', 'business-center-pro' ) ) ) ); // Horizontal Line $wp_customize->add_setting( 'business_center_pro_theme_options[service_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[service_content_type_hr' . $i . ']', array( 'active_callback' => 'business_center_pro_is_service_content_type_custom_enable', 'section' => 'business_center_pro_service_section', 'type' => 'hr', ) ) ); } /** * Category Content Type Options */ // Catgegory Options $wp_customize->add_setting( 'business_center_pro_theme_options[service_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[service_category]', array( 'active_callback' => 'business_center_pro_is_service_content_type_category_enable', 'label' => esc_html__( 'Select Category', 'business-center-pro' ), 'section' => 'business_center_pro_service_section', 'type' => 'checkbox-multiple', 'taxonomy' => 'category', ) ) );