add_section( 'business_center_pro_portfolio_section', array( 'title' => esc_html__( 'Portfolio Options','business-center-pro' ), 'description' => esc_html__( 'Portfolio options.', 'business-center-pro' ), 'panel' => 'business_center_pro_sections_panel', ) ); /** * Portfolio Options */ // Enable portfolio. $wp_customize->add_setting( 'business_center_pro_theme_options[enable_portfolio]', array( 'default' => $options['enable_portfolio'], 'sanitize_callback' => 'business_center_pro_sanitize_checkbox', ) ); $wp_customize->add_control( 'business_center_pro_theme_options[enable_portfolio]', array( 'label' => esc_html__( 'Enable Portfolio Section?', 'business-center-pro' ), 'section' => 'business_center_pro_portfolio_section', 'type' => 'checkbox' ) ); // Portfolio title. $wp_customize->add_setting( 'business_center_pro_theme_options[portfolio_title]', array( 'default' => $options['portfolio_title'], 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'business_center_pro_theme_options[portfolio_title]', array( 'active_callback' => 'business_center_pro_is_portfolio_enable', 'label' => esc_html__( 'Title:', 'business-center-pro' ), 'section' => 'business_center_pro_portfolio_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[portfolio_title]', array( 'selector' => '#portfolio-slider .entry-header .entry-title', 'render_callback' => 'business_center_pro_partial_portfolio_title', 'container_inclusive' => false, 'fallback_refresh' => true, ) ); } // Portfolio sub-title. $wp_customize->add_setting( 'business_center_pro_theme_options[portfolio_sub_title]', array( 'default' => $options['portfolio_sub_title'], 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'business_center_pro_theme_options[portfolio_sub_title]', array( 'active_callback' => 'business_center_pro_is_portfolio_enable', 'label' => esc_html__( 'Sub Title:', 'business-center-pro' ), 'section' => 'business_center_pro_portfolio_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[portfolio_sub_title]', array( 'selector' => '#portfolio-slider .entry-header .subtitle', 'render_callback' => 'business_center_pro_partial_portfolio_sub_title', 'container_inclusive' => false, 'fallback_refresh' => true, ) ); } /** * Portfolio content type options. */ $wp_customize->add_setting( 'business_center_pro_theme_options[portfolio_content_type]', array( 'default' => $options['portfolio_content_type'], 'sanitize_callback' => 'business_center_pro_sanitize_select', ) ); $wp_customize->add_control( 'business_center_pro_theme_options[portfolio_content_type]', array( 'active_callback' => 'business_center_pro_is_portfolio_enable', 'label' => esc_html__( 'Content Type', 'business-center-pro' ), 'section' => 'business_center_pro_portfolio_section', 'choices' => business_center_pro_portfolio_content_type_options(), 'type' => 'select' ) ); // Number of portfolios. $wp_customize->add_setting( 'business_center_pro_theme_options[number_of_portfolios]', array( 'default' => $options['number_of_portfolios'], 'sanitize_callback' => 'business_center_pro_sanitize_number_range', ) ); $wp_customize->add_control( 'business_center_pro_theme_options[number_of_portfolios]', array( 'active_callback' => 'business_center_pro_is_portfolio_demo_disable', 'label' => esc_html__( 'Number of portfolios? ( 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_portfolio_section', 'input_attrs' => array( 'min' => 1, 'max' => 6 ), 'type' => 'number' ) ); for ( $i=1; $i <= $options['number_of_portfolios']; $i++ ) { /** * Custom Content Type Options */ // Portfolio image options $wp_customize->add_setting( 'business_center_pro_theme_options[custom_portfolio_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_portfolio_image_'.$i.']', array( 'active_callback' => 'business_center_pro_is_portfolio_content_type_custom_enable', 'label' => esc_html__( 'Portfolio Image ', 'business-center-pro' ) . $i, 'description' => esc_html__( 'The recommeded size for the image is 400px by 225px. ', 'business-center-pro' ) . $i, 'section' => 'business_center_pro_portfolio_section', ) ) ); // Portfolio alt text options $wp_customize->add_setting( 'business_center_pro_theme_options[custom_portfolio_alt_text_'.$i.']', array( 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'business_center_pro_theme_options[custom_portfolio_alt_text_'.$i.']', array( 'active_callback' => 'business_center_pro_is_portfolio_content_type_custom_enable', 'label' => esc_html__( 'Portfolio Alt Text ', 'business-center-pro' ) . $i, 'section' => 'business_center_pro_portfolio_section', 'type' => 'text', ) ); // Portfolio url options $wp_customize->add_setting( 'business_center_pro_theme_options[custom_portfolio_url_'.$i.']', array( 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( 'business_center_pro_theme_options[custom_portfolio_url_'.$i.']', array( 'active_callback' => 'business_center_pro_is_portfolio_content_type_custom_enable', 'label' => esc_html__( 'Portfolio URL ', 'business-center-pro' ) . $i, 'section' => 'business_center_pro_portfolio_section', 'type' => 'url', ) ); // Horizontal Line $wp_customize->add_setting( 'business_center_pro_theme_options[portfolio_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[portfolio_content_type_hr' . $i . ']', array( 'active_callback' => 'business_center_pro_is_portfolio_content_type_custom_enable', 'section' => 'business_center_pro_portfolio_section', 'type' => 'hr', ) ) ); } /** * Category Content Type Options */ // Catgegory Options $wp_customize->add_setting( 'business_center_pro_theme_options[portfolio_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[portfolio_category]', array( 'active_callback' => 'business_center_pro_is_portfolio_content_type_category_enable', 'label' => esc_html__( 'Select Category', 'business-center-pro' ), 'section' => 'business_center_pro_portfolio_section', 'type' => 'checkbox-multiple', 'taxonomy' => 'category', ) ) );