add_section( 'business_center_pro_client_section', array( 'title' => esc_html__( 'Client Options','business-center-pro' ), 'description' => esc_html__( 'Client options.', 'business-center-pro' ), 'panel' => 'business_center_pro_sections_panel', ) ); /** * Client Options */ // Enable client. $wp_customize->add_setting( 'business_center_pro_theme_options[enable_client]', array( 'default' => $options['enable_client'], 'sanitize_callback' => 'business_center_pro_sanitize_checkbox', ) ); $wp_customize->add_control( 'business_center_pro_theme_options[enable_client]', array( 'label' => esc_html__( 'Enable Client Section?', 'business-center-pro' ), 'section' => 'business_center_pro_client_section', 'type' => 'checkbox' ) ); // Client title. $wp_customize->add_setting( 'business_center_pro_theme_options[client_title]', array( 'default' => $options['client_title'], 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'business_center_pro_theme_options[client_title]', array( 'active_callback' => 'business_center_pro_is_client_enable', 'label' => esc_html__( 'Title:', 'business-center-pro' ), 'section' => 'business_center_pro_client_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[client_title]', array( 'selector' => '#client-logos .entry-header .entry-title', 'render_callback' => 'business_center_pro_partial_client_title', 'container_inclusive' => false, 'fallback_refresh' => true, ) ); } // Client sub-title. $wp_customize->add_setting( 'business_center_pro_theme_options[client_sub_title]', array( 'default' => $options['client_sub_title'], 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'business_center_pro_theme_options[client_sub_title]', array( 'active_callback' => 'business_center_pro_is_client_enable', 'label' => esc_html__( 'Sub Title:', 'business-center-pro' ), 'section' => 'business_center_pro_client_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[client_sub_title]', array( 'selector' => '#client-logos .entry-header .subtitle', 'render_callback' => 'business_center_pro_partial_client_sub_title', 'container_inclusive' => false, 'fallback_refresh' => true, ) ); } /** * Client content type options. */ $wp_customize->add_setting( 'business_center_pro_theme_options[client_content_type]', array( 'default' => $options['client_content_type'], 'sanitize_callback' => 'business_center_pro_sanitize_select', ) ); $wp_customize->add_control( 'business_center_pro_theme_options[client_content_type]', array( 'active_callback' => 'business_center_pro_is_client_enable', 'label' => esc_html__( 'Content Type', 'business-center-pro' ), 'section' => 'business_center_pro_client_section', 'choices' => business_center_pro_client_content_type_options(), 'type' => 'select' ) ); // Number of client. $wp_customize->add_setting( 'business_center_pro_theme_options[number_of_client]', array( 'default' => $options['number_of_client'], 'sanitize_callback' => 'business_center_pro_sanitize_number_range', ) ); $wp_customize->add_control( 'business_center_pro_theme_options[number_of_client]', array( 'active_callback' => 'business_center_pro_is_client_demo_disable', 'label' => esc_html__( 'Number of client? ( 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_client_section', 'input_attrs' => array( 'min' => 1, 'max' => 6 ), 'type' => 'number' ) ); for ( $i=1; $i <= $options['number_of_client']; $i++ ) { /** * Custom Content Type Options */ // Client image options $wp_customize->add_setting( 'business_center_pro_theme_options[custom_client_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_client_image_'.$i.']', array( 'active_callback' => 'business_center_pro_is_client_demo_disable', 'label' => esc_html__( 'Client Logo ', 'business-center-pro' ) . $i, 'section' => 'business_center_pro_client_section', ) ) ); // Client link options $wp_customize->add_setting( 'business_center_pro_theme_options[custom_client_link_'.$i.']', array( 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( 'business_center_pro_theme_options[custom_client_link_'.$i.']', array( 'active_callback' => 'business_center_pro_is_client_demo_disable', 'label' => esc_html__( 'Client Link ', 'business-center-pro' ) . $i, 'section' => 'business_center_pro_client_section', ) ); }