add_section( 'aster_bike_rental_services_section', array( 'panel' => 'aster_bike_rental_front_page_options', 'title' => esc_html__( 'Products Section', 'aster-bike-rental' ), 'priority' => 10, ) ); // Products Section - Enable Section. $wp_customize->add_setting( 'aster_bike_rental_enable_service_section', array( 'default' => true, 'sanitize_callback' => 'aster_bike_rental_sanitize_switch', ) ); $wp_customize->add_control( new Aster_Bike_Rental_Toggle_Switch_Custom_Control( $wp_customize, 'aster_bike_rental_enable_service_section', array( 'label' => esc_html__( 'Enable Products Section', 'aster-bike-rental' ), 'section' => 'aster_bike_rental_services_section', 'settings' => 'aster_bike_rental_enable_service_section', ) ) ); if ( isset( $wp_customize->selective_refresh ) ) { $wp_customize->selective_refresh->add_partial( 'aster_bike_rental_enable_service_section', array( 'selector' => '#aster_bike_rental_service_section .section-link', 'settings' => 'aster_bike_rental_enable_service_section', ) ); } // Products Section - Short Heading. $wp_customize->add_setting( 'aster_bike_rental_trending_product_heading', array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'aster_bike_rental_trending_product_heading', array( 'label' => esc_html__( 'Product Heading', 'aster-bike-rental' ), 'section' => 'aster_bike_rental_services_section', 'settings' => 'aster_bike_rental_trending_product_heading', 'type' => 'text', 'active_callback' => 'aster_bike_rental_is_service_section_enabled', ) ); if(class_exists('woocommerce')){ $aster_bike_rental_args = array( 'type' => 'product', 'child_of' => 0, 'parent' => '', 'orderby' => 'term_group', 'order' => 'ASC', 'hide_empty' => false, 'hierarchical' => 1, 'number' => '', 'taxonomy' => 'product_cat', 'pad_counts' => false ); $aster_bike_rental_categories = get_categories($aster_bike_rental_args); $cat_posts = array(); $m = 0; $cat_posts[]='Select'; foreach($aster_bike_rental_categories as $category){ if($m==0){ $default = $category->slug; $m++; } $cat_posts[$category->slug] = $category->name; } $wp_customize->add_setting('aster_bike_rental_trending_product_category',array( 'default' => 'select', 'sanitize_callback' => 'aster_bike_rental_sanitize_select', )); $wp_customize->add_control('aster_bike_rental_trending_product_category',array( 'type' => 'select', 'choices' => $cat_posts, 'label' => __('Select category to display products ','aster-bike-rental'), 'section' => 'aster_bike_rental_services_section', 'active_callback' => 'aster_bike_rental_is_service_section_enabled', )); } for ($i=1; $i <= 8; $i++) { // Products Section - Short Heading. $wp_customize->add_setting( 'aster_bike_rental_trending_product_material_text' . $i, array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'aster_bike_rental_trending_product_material_text' . $i, array( 'label' => esc_html__( 'Product Material ', 'aster-bike-rental' ) . $i, 'section' => 'aster_bike_rental_services_section', 'settings' => 'aster_bike_rental_trending_product_material_text' . $i, 'type' => 'text', 'active_callback' => 'aster_bike_rental_is_service_section_enabled', ) ); // Products Section - Short Heading. $wp_customize->add_setting( 'aster_bike_rental_trending_product_frame_size_text' . $i, array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'aster_bike_rental_trending_product_frame_size_text' . $i, array( 'label' => esc_html__( 'Product Frame Size ', 'aster-bike-rental' ) . $i, 'section' => 'aster_bike_rental_services_section', 'settings' => 'aster_bike_rental_trending_product_frame_size_text' . $i, 'type' => 'text', 'active_callback' => 'aster_bike_rental_is_service_section_enabled', ) ); // Products Section - Short Heading. $wp_customize->add_setting( 'aster_bike_rental_trending_product_color_text' . $i, array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'aster_bike_rental_trending_product_color_text' . $i, array( 'label' => esc_html__( 'Product Color ', 'aster-bike-rental' ). $i, 'section' => 'aster_bike_rental_services_section', 'settings' => 'aster_bike_rental_trending_product_color_text' . $i, 'type' => 'text', 'active_callback' => 'aster_bike_rental_is_service_section_enabled', ) ); // Products Section - Short Heading. $wp_customize->add_setting( 'aster_bike_rental_trending_product_weight_text' . $i, array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'aster_bike_rental_trending_product_weight_text' . $i, array( 'label' => esc_html__( 'Product Weight ', 'aster-bike-rental' ) . $i, 'section' => 'aster_bike_rental_services_section', 'settings' => 'aster_bike_rental_trending_product_weight_text' . $i, 'type' => 'text', 'active_callback' => 'aster_bike_rental_is_service_section_enabled', ) ); }