add_section( 'gridchamp_woo_product_section', array( 'title' => esc_html__( 'Products', 'gridchamp' ), 'panel' => 'gridchamp_frontpage_option', 'priority' => 4, ) ); if(gridchamp_set_to_premium() && class_exists('woocommerce')){ $wp_customize->add_setting( 'gridchamp_prouduct_status', array( 'default' => false, 'sanitize_callback' => 'gridchamp_sanitize_checkbox' ) ); $wp_customize->add_control( 'gridchamp_prouduct_status', array( 'label' => esc_html__( 'Display Product Section', 'gridchamp' ), 'section' => 'gridchamp_woo_product_section', 'settings' => 'gridchamp_prouduct_status', 'type' => 'checkbox', 'priority' => 1 ) ); $wp_customize->add_setting( 'gridchamp_product_section_padding_top', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'gridchamp_sanitize_number_absint', 'default' => 50, ) ); $wp_customize->add_control( 'gridchamp_product_section_padding_top', array( 'type' => 'number', 'section' => 'gridchamp_woo_product_section', 'settings' => 'gridchamp_product_section_padding_top', 'label' => esc_html__( 'Section Top Space','gridchamp' ), 'description' => '', 'input_attrs' => array( 'min' => 0, 'max' => 300, 'step' => 1, ), 'priority' => 50, 'active_callback' => function(){ return get_theme_mod( 'gridchamp_prouduct_status', true ); }, ) ); $wp_customize->add_setting( 'gridchamp_product_section_padding_bottom', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'gridchamp_sanitize_number_absint', 'default' => 50, ) ); $wp_customize->add_control( 'gridchamp_product_section_padding_bottom', array( 'type' => 'number', 'section' => 'gridchamp_woo_product_section', 'settings' => 'gridchamp_product_section_padding_bottom', 'label' => esc_html__( 'Section Bottom Space','gridchamp' ), 'description' => '', 'input_attrs' => array( 'min' => 0, 'max' => 300, 'step' => 1, ), 'priority' => 50, 'active_callback' => function(){ return get_theme_mod( 'gridchamp_prouduct_status', true ); }, ) ); $gridchamp_product_layout_choices =array( 'gridchamp-product-layout-slide' => esc_html__('Carousel Layout','gridchamp'), 'gridchamp-product-layout-grid' => esc_html__('Grid Layout','gridchamp'), ); $wp_customize->add_setting( 'gridchamp_product_layout', array( 'default' => 'gridchamp-product-layout-slide', 'sanitize_callback' => 'gridchamp_sanitize_choices' ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'gridchamp_product_layout', array( 'section' => 'gridchamp_woo_product_section', 'label' => esc_html__( 'Choose Section Layout', 'gridchamp' ), 'description' => '', 'type' => 'select', 'settings' => 'gridchamp_product_layout', 'priority' => 2, 'choices' => $gridchamp_product_layout_choices, 'active_callback' => function(){ return get_theme_mod( 'gridchamp_prouduct_status', true ); }, ) ) ); $wp_customize->add_setting( 'product_heading_text', array( 'capability' => 'edit_theme_options', 'default' => '', 'sanitize_callback' => 'gridchamp_sanitize_text', ) ); $wp_customize->add_control( 'product_heading_text', array( 'type' => 'text', 'section' => 'gridchamp_woo_product_section', 'label' => esc_html__( 'Heading','gridchamp' ), 'description' => esc_html__( 'Heading text for display on product section','gridchamp' ), 'active_callback' => function(){ return get_theme_mod( 'gridchamp_prouduct_status', true ); }, 'priority' => 3, ) ); $wp_customize->add_setting( 'product_desc_text', array( 'capability' => 'edit_theme_options', 'default' => '', 'sanitize_callback' => 'sanitize_textarea_field', ) ); $wp_customize->add_control( 'product_desc_text', array( 'type' => 'text', 'section' => 'gridchamp_woo_product_section', 'label' => esc_html__( 'Description','gridchamp' ), 'description' => esc_html__( 'Short Description text for display on product section','gridchamp' ), 'active_callback' => function(){ return get_theme_mod( 'gridchamp_prouduct_status', true ); }, 'priority' => 3, ) ); $wp_customize->add_setting( 'gridchamp_product_post_per_page', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'gridchamp_sanitize_number_absint', 'default' => 8, ) ); $wp_customize->add_control( 'gridchamp_product_post_per_page', array( 'type' => 'number', 'section' => 'gridchamp_woo_product_section', 'settings' => 'gridchamp_product_post_per_page', 'label' => esc_html__( 'Post Per Page','gridchamp' ), 'description' => esc_html__('Total item to be shown on homepage product section','gridchamp'), 'input_attrs' => array( 'min' => 4, 'max' => 12, 'step' => 1, ), 'priority' => 4, 'active_callback' => function(){ return get_theme_mod( 'gridchamp_prouduct_status', true ); }, ) ); } } } add_action( 'customize_register', 'gridchamp_woo_options_register' );