"", "category" => "", "shortcode" => "", "product_style" => "style01", "display_elements" => "", "quick_view_style" => "expandable", "label_on_sale" => "Sale!", "text_align" => "left", "img_animate" => "rotate-clock", "pagination" => "", "color_heading" => "", "color_categories" => "", "color_price" => "", "color_rating" => "", "color_rating_bg" => "", "color_quick_bg" => "", "color_quick" => "", "color_cart_bg" => "", "color_on_sale_bg" => "", "color_on_sale" => "", "color_cart" => "", "color_product_desc" => "", "color_product_desc_bg" => "", "size_title" => "", "size_cat" => "", "size_price" => "", "border_style" => "", "border_color" => "", "border_size" => "", "border_radius" => "", "product_animation" => "", "lazy_images" => "", "advanced_opts" => "", "sale_price" => "", "on_sale_style" => "wcmp-sale-circle", "on_sale_alignment" => "wcmp-sale-right", "product_img_disp" => "single", ),$atts)); $output = $heading_style = $cat_style = $price_style = $cart_style = $cart_bg_style = $view_style = $view_bg_style = $rating_style = ''; $desc_style = $label_style = $on_sale = $class = $style = $border = $desc_style = $sale_price_size = ''; $image_size = apply_filters( 'single_product_large_thumbnail_size', 'shop_single' ); $img_animate = 'wcmp-img-'.$img_animate; if($sale_price !== ''){ $sale_price_size = 'font-size:'.$sale_price.'px;'; } if($border_style !== ''){ $border .= 'border:'.$border_size.'px '.$border_style.' '.$border_color.';'; $border .= 'border-radius:'.$border_radius.'px;'; } if($color_product_desc_bg !== ''){ $desc_style .= 'background:'.$color_product_desc_bg.';'; } if($color_product_desc !== ''){ $desc_style .= 'color:'.$color_product_desc.';'; } $columns = 3; $display_type = $disp_type; if($color_heading !== ""){ $heading_style = 'color:'.$color_heading.';'; } if($size_title !== ""){ $heading_style .= 'font-size:'.$size_title.'px;'; } if($color_categories !== ""){ $cat_style = 'color:'.$color_categories.';'; } if($size_cat !== ""){ $cat_style .= 'font-size:'.$size_cat.'px;'; } if($color_price !== ""){ $price_style = 'color:'.$color_price.';'; } if($size_price !== ""){ $price_style .= 'font-size:'.$size_price.'px;'; } if($color_rating !== ""){ $rating_style .= 'color:'.$color_rating.';'; } if($color_rating_bg !== ""){ $rating_style .= 'background:'.$color_rating_bg.';'; } if($color_quick_bg !== ""){ $view_bg_style = 'background:'.$color_quick_bg.';'; } if($color_quick !== ""){ $view_style = 'color:'.$color_quick.';'; } if($color_cart_bg !== ""){ $cart_bg_style = 'background:'.$color_cart_bg.';'; } if($color_cart !== ""){ $cart_style = 'color:'.$color_cart.';'; } if($color_on_sale_bg !== ""){ $label_style = 'background:'.$color_on_sale_bg.';'; } if($color_on_sale !== ""){ $label_style .= 'color:'.$color_on_sale.';'; } $elemets = explode(",",$display_elements); if($element == "grid"){ $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1; } else { $paged = 1; } $post_count = '12'; /* $output .= do_shortcode($content); */ if($shortcode !== ''){ $new_shortcode = rawurldecode( base64_decode( strip_tags( $shortcode ) ) ); } $pattern = get_shortcode_regex(); $shortcode_str = $short_atts = ''; preg_match_all("/".$pattern."/",$new_shortcode,$matches); $shortcode_str = str_replace('"','',str_replace(" ","&",trim($matches[3][0]))); parse_str($shortcode_str, $short_atts);//explode("&",$shortcode_str); if(isset($matches[2][0])): $display_type = $matches[2][0]; else: $display_type = ''; endif; if(!isset($columns)): $columns = '4'; endif; if(isset($per_page)): $post_count = $per_page; endif; if(isset($number)): $post_count = $number; endif; if(!isset($order)): $order = 'asc'; endif; if(!isset($orderby)): $orderby = 'date'; endif; if(!isset($category)): $category = ''; endif; if(!isset($ids)): $ids = ''; endif; if($ids){ $ids = explode( ',', $ids ); $ids = array_map( 'trim', $ids ); } $col = $columns; if($columns == "2") $columns = 6; elseif($columns == "3") $columns = 4; elseif($columns == "4") $columns = 3; $meta_query = ''; if($display_type == "recent_products"){ $meta_query = WC()->query->get_meta_query(); } if($display_type == "featured_products"){ $meta_query = array( array( 'key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN' ), array( 'key' => '_featured', 'value' => 'yes' ) ); } if($display_type == "top_rated_products"){ add_filter( 'posts_clauses', array( WC()->query, 'order_by_rating_post_clauses' ) ); $meta_query = WC()->query->get_meta_query(); } $args = array( 'post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $post_count, 'orderby' => $orderby, 'order' => $order, 'paged' => $paged, 'meta_query' => $meta_query ); if($display_type == "sale_products"){ $product_ids_on_sale = woocommerce_get_product_ids_on_sale(); $meta_query = array(); $meta_query[] = $woocommerce->query->visibility_meta_query(); $meta_query[] = $woocommerce->query->stock_status_meta_query(); $args['meta_query'] = $meta_query; $args['post__in'] = $product_ids_on_sale; } if($display_type == "best_selling_products"){ $args['meta_key'] = 'total_sales'; $args['orderby'] = 'meta_value_num'; $args['meta_query'] = array( array( 'key' => '_visibility', 'value' => array( 'catalog', 'visible' ), 'compare' => 'IN' ) ); } if($display_type == "product_category"){ $args['tax_query'] = array( array( 'taxonomy' => 'product_cat', 'terms' => array( esc_attr( $category ) ), 'field' => 'slug', 'operator' => 'IN' ) ); } if($display_type == "product_categories"){ $args['tax_query'] = array( array( 'taxonomy' => 'product_cat', 'terms' => $ids, 'field' => 'term_id', 'operator' => 'IN' ) ); } $test = ''; if(vc_is_inline()){ $test = "wcmp_vc_inline"; } if($product_animation == ''){ $product_animation = 'no-animation'; } else { $style .= 'opacity:1;'; } if($element == "grid"){ $class = 'vc_span'.$columns.' '; } $output .= '