'', 'image' => '', 'number' => '8', 'custom_css' => '', ),$attr)); if(!empty($category)){ $css_class = vc_shortcode_custom_css_class( $custom_css ); $term = get_term_by('slug', $category, 'product_cat'); $term_link = get_term_link( $term, 'product_cat' ); $args = array( 'post_type' => 'product', 'posts_per_page' => $number, ); $args['tax_query'][]=array( 'taxonomy'=>'product_cat', 'field'=>'slug', 'terms'=> array($category) ); $product_query = new WP_Query($args); $count_query = $product_query->post_count; $html .= '
'.wp_get_attachment_image($image,array(305,305)).'

'.$term->name.' '.$term->count.' '.esc_html__("items","bigc").'

'.$term->name.'

'.esc_html__("Close","bigc").'
'; $count = 1; if($product_query->have_posts()) { while($product_query->have_posts()) { $product_query->the_post(); global $product,$post; if(has_post_thumbnail(get_the_ID())) $thumb_html = get_the_post_thumbnail(get_the_ID(),array(270,270),array('class'=>'img-responsive')); else $thumb_html = ''; if($count % 8 == 1) $html .= '
    '; $html .= '
  • '.$thumb_html.' '.sv_get_meta_product('yes').'
    '.$product->get_price_html().'
  • '; if($count % 8 == 0 || $count == $count_query) $html .= '
'; $count++; } } $html .= '
'; } return $html; } } stp_reg_shortcode('sv_category_box','sv_vc_category_box'); add_action( 'vc_build_admin_page','sv_admin_category_box' ); if ( ! function_exists( 'sv_admin_category_box' ) ) { function sv_admin_category_box(){ vc_map( array( "name" => esc_html__("SV Category Box", 'bigc'), "base" => "sv_category_box", "icon" => "icon-st", "category" => '7Up-theme', "params" => array( array( 'type' => 'dropdown', 'heading' => esc_html__( 'Category', 'bigc' ), 'description' => esc_html__( 'Choose Category View', 'bigc' ), 'param_name' => 'category', 'value' => sv_list_taxonomy('product_cat') ), array( "type" => "attach_image", "heading" => esc_html__("Image",'bigc'), "param_name" => "image", ), array( "type" => "textfield", "heading" => esc_html__("Number",'bigc'), "param_name" => "number", ), array( "type" => "css_editor", "heading" => esc_html__("Custom Block",'bigc'), "param_name" => "custom_css", 'group' => esc_html__('Advanced','bigc') ) ) )); } }