add_section( 'business_center_pro_skill_section', array( 'title' => esc_html__( 'Skill Options','business-center-pro' ), 'description' => esc_html__( 'Skill options.', 'business-center-pro' ), 'panel' => 'business_center_pro_sections_panel', ) ); /** * Skill Options */ // Enable skill. $wp_customize->add_setting( 'business_center_pro_theme_options[enable_skill]', array( 'default' => $options['enable_skill'], 'sanitize_callback' => 'business_center_pro_sanitize_checkbox', ) ); $wp_customize->add_control( 'business_center_pro_theme_options[enable_skill]', array( 'label' => esc_html__( 'Enable Skill Section?', 'business-center-pro' ), 'section' => 'business_center_pro_skill_section', 'type' => 'checkbox' ) ); // Skill title. $wp_customize->add_setting( 'business_center_pro_theme_options[skill_title]', array( 'default' => $options['skill_title'], 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'business_center_pro_theme_options[skill_title]', array( 'active_callback' => 'business_center_pro_is_skill_enable', 'label' => esc_html__( 'Title:', 'business-center-pro' ), 'section' => 'business_center_pro_skill_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[skill_title]', array( 'selector' => '#piechart .entry-header .entry-title', 'render_callback' => 'business_center_pro_partial_skill_title', 'container_inclusive' => false, 'fallback_refresh' => true, ) ); } // Skill sub-title. $wp_customize->add_setting( 'business_center_pro_theme_options[skill_sub_title]', array( 'default' => $options['skill_sub_title'], 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'business_center_pro_theme_options[skill_sub_title]', array( 'active_callback' => 'business_center_pro_is_skill_enable', 'label' => esc_html__( 'Sub Title:', 'business-center-pro' ), 'section' => 'business_center_pro_skill_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[skill_sub_title]', array( 'selector' => '#piechart .entry-header .subtitle', 'render_callback' => 'business_center_pro_partial_skill_sub_title', 'container_inclusive' => false, 'fallback_refresh' => true, ) ); } /** * Skill content type options. */ $wp_customize->add_setting( 'business_center_pro_theme_options[skill_content_type]', array( 'default' => $options['skill_content_type'], 'sanitize_callback' => 'business_center_pro_sanitize_select', ) ); $wp_customize->add_control( 'business_center_pro_theme_options[skill_content_type]', array( 'active_callback' => 'business_center_pro_is_skill_enable', 'label' => esc_html__( 'Content Type', 'business-center-pro' ), 'section' => 'business_center_pro_skill_section', 'choices' => business_center_pro_skill_content_type_options(), 'type' => 'select' ) ); // Number of skill. $wp_customize->add_setting( 'business_center_pro_theme_options[number_of_skill]', array( 'default' => $options['number_of_skill'], 'sanitize_callback' => 'business_center_pro_sanitize_number_range', ) ); $wp_customize->add_control( 'business_center_pro_theme_options[number_of_skill]', array( 'active_callback' => 'business_center_pro_is_skill_demo_disable', 'label' => esc_html__( 'Number of skill? ( 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_skill_section', 'input_attrs' => array( 'min' => 1, 'max' => 6 ), 'type' => 'number' ) ); for ( $i=0; $i < $options['number_of_skill']; $i++ ) { /** * Custom Content Type Options */ // Skill name text options $wp_customize->add_setting( 'business_center_pro_theme_options[custom_skill_name_'.$i.']', array( 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'business_center_pro_theme_options[custom_skill_name_'.$i.']', array( 'active_callback' => 'business_center_pro_is_skill_content_type_custom_enable', 'label' => esc_html__( 'Name ', 'business-center-pro' ) . ($i+1), 'section' => 'business_center_pro_skill_section', 'type' => 'text', ) ); // Skill color options $wp_customize->add_setting( 'business_center_pro_theme_options[custom_skill_color_'.$i.']', array( 'sanitize_callback' => 'sanitize_hex_color' ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'business_center_pro_theme_options[custom_skill_color_'.$i.']', array( 'active_callback' => 'business_center_pro_is_skill_content_type_custom_enable', 'label' => esc_html__( 'Color ', 'business-center-pro' ) . ($i+1), 'section' => 'business_center_pro_skill_section', ) ) ); // Skill value options $wp_customize->add_setting( 'business_center_pro_theme_options[custom_skill_value_'.$i.']', array( 'sanitize_callback' => 'business_center_pro_sanitize_number_range' ) ); $wp_customize->add_control( 'business_center_pro_theme_options[custom_skill_value_'.$i.']', array( 'active_callback' => 'business_center_pro_is_skill_content_type_custom_enable', 'label' => esc_html__( 'Value ', 'business-center-pro' ) . ($i+1), 'description' => esc_html__( 'The value is in percentage(%). ', 'business-center-pro' ), 'section' => 'business_center_pro_skill_section', 'type' => 'number', 'input_attrs' => array( 'max' => 100, 'min' => 0 ), ) ); }