/' ); echo '"; } } } /** 2.Function to list post categories in customizer options */ if( ! function_exists( 'buzz_ecommerce_get_products_categories' ) ) { /** * Function to list post categories in customizer options */ function buzz_ecommerce_get_products_categories( ){ if(!buzz_ecommerce_is_woocommerce_activated()): return; endif; /* Option list of all categories */ $taxonomy = 'product_cat'; $orderby = 'name'; $show_count = 0; $pad_counts = 0; $hierarchical = 1; $title = ''; $empty = 0; $args = array( 'taxonomy' => $taxonomy, 'orderby' => $orderby, 'show_count' => $show_count, 'pad_counts' => $pad_counts, 'hierarchical' => $hierarchical, 'title_li' => $title, 'hide_empty' => $empty ); $all_categories = get_categories( $args ); foreach( $all_categories as $category ){ $categories[$category->term_id] = $category->name; } return $categories; } } /** 3.get Post Category */ if( ! function_exists( 'buzz_ecommerce_get_post_categories' ) ) { /** * Function to list post categories in customizer options */ function buzz_ecommerce_get_post_categories( ){ $all_categories = get_categories( ); //default value $categories['all'] = 'all'; foreach( $all_categories as $category ){ $categories[$category->term_id] = $category->name; } return $categories; } } /** 4.get Woocommerce Products Id*/ if( ! function_exists( 'buzz_ecommerce_get_woocommerce_products_id' ) ) { /** * Function to list post categories in customizer options */ function buzz_ecommerce_get_woocommerce_products_id( ){ //products $product_args = array( 'post_type' => 'product', 'posts_per_page' => -1 ); $query = new WP_Query( $product_args ); if($query->have_posts()) { while( $query->have_posts() ) { $query->the_post(); $categories[ get_the_ID() ] = get_the_title(); }} return $categories; } } /** * 5. Default woocommerce Default category */ if( ! function_exists( 'buzz_ecommerce_get_default_products_categories' ) ) { /** * Defaul category section */ function buzz_ecommerce_get_default_products_categories( ){ if(!buzz_ecommerce_is_woocommerce_activated()): return; endif; //Default cat $taxonomy = 'product_cat'; $orderby = 'name'; $show_count = 0; $pad_counts = 0; $hierarchical = 1; $title = ''; $empty = 0; $args = array( 'taxonomy' => $taxonomy, 'orderby' => $orderby, 'show_count' => $show_count, 'pad_counts' => $pad_counts, 'hierarchical' => $hierarchical, 'title_li' => $title, 'hide_empty' => $empty ); $all_categories = get_categories( $args ); //Default Select $default_product_cat = ''; foreach( $all_categories as $cat ) { //Select default category Hear if( $cat->count >= 4 ){ $default_product_cat = $cat->term_id; } } //not category select then if( empty($default_product_cat) ){ foreach( $all_categories as $cat ) { //Select default category Hear $default_product_cat = $cat->term_id; } } //Return default cat return $default_product_cat; } } //Default multiple category select /** 6.Multiple Category Select Section */ if( ! function_exists( 'buzz_ecommerce_get_multiple_product_categories' ) ) { /** * Function to list post categories in customizer options */ function buzz_ecommerce_get_multiple_product_categories( ){ //Default cat $taxonomy = 'product_cat'; $orderby = 'name'; $show_count = 0; $pad_counts = 0; $hierarchical = 1; $title = ''; $empty = 0; $args = array( 'taxonomy' => $taxonomy, 'orderby' => $orderby, 'show_count' => $show_count, 'pad_counts' => $pad_counts, 'hierarchical' => $hierarchical, 'title_li' => $title, 'hide_empty' => $empty ); $all_categories = get_categories( $args ); //Default Select $category_count = 0; foreach( $all_categories as $cat ) { //Select default category Hear $default_product_cat = array(); if( $category_count < 5 ){ $default_product_cat[$category_count] = $cat->term_id; } //increment count $category_count++; } //Return default cat return $default_product_cat; } } /** * * Buzz Ecommerce header Search options hear */ function buzz_ecommerce_header_search() { ?>