if ($terms) { foreach ($terms as $cat) { $classes .= ' ' . $cat->slug; } } ?> <div class="grid-item<?php echo $product->is_on_sale() ? ' sale' : ''; echo $classes; ?> "> <?php $thumbnal_id = get_post_thumbnail_id($product->id); $img = wp_get_attachment_image_src($thumbnal_id, 'shop_catalog', true); echo '<a class="product-image" href="' . get_permalink($product->id) . '">'; woocommerce_show_product_loop_sale_flash(); if (has_post_thumbnail($product->id)) { echo '<img src="' . placeImg($img[1], $img[2]) . '" alt="' . get_alt($thumbnal_id) . '" data-defer="' . $img[0] . '" class="aligncenter" width="' . $img[1] . '" height="' . $img[2] . '" />'; } else { echo wc_placeholder_img('shop_catalog'); } echo '</a>'; ?> <div class="product-data"> <a class="product-title" href="<?php the_permalink(); ?> "> <h3><?php echo get_the_title($product->id); ?>
public function dhvc_woo_products_shortcode($atts, $content = null) { extract(shortcode_atts(array('id' => '', 'heading' => '', 'heading_color' => '#47A3DA', 'heading_font_size' => '20px', 'query_options' => '', 'query_type' => '1', 'products' => '', 'exclude_products' => '', 'category' => '', 'exclude_category' => '', 'brand' => '', 'exclude_brand' => '', 'tag' => '', 'exclude_tag' => '', 'attribute' => '', 'posts_per_page' => '6', 'post_per_row' => '2', 'show' => '', 'orderby' => 'date', 'order' => 'ASC', 'hide_free' => '', 'show_hidden' => '', 'style_options' => '', 'display' => 'grid', 'hide_result_count' => '', 'hide_ordering_list' => '', 'show_grid_pagination' => '', 'show_masonry_filter' => '1', 'masonry_filters_background' => '#ffffff', 'masonry_filters_selected_background' => '#47A3DA', 'masonry_filters_color' => '#666666', 'masonry_filters_selected_color' => '#ffffff', 'masonry_filters_border_color' => '#ffffff', 'masonry_filters_selected_border_color' => '#47A3DA', 'masonry_gutter' => 10, 'hide_carousel_arrows' => '1', 'show_carousel_pagination' => '', 'carousel_arrow_background' => '#CFCDCD', 'carousel_arrow_hover_background' => '#47A3DA', 'carousel_arrow_color' => '#ffffff', 'carousel_arrow_hover_color' => '#ffffff', 'carousel_arrow_size' => '24px', 'carousel_arrow_front_size' => '12px', 'carousel_arrow_border_radius' => '3px', 'carousel_pagination_background' => '#869791', 'carousel_pagination_active_background' => '#47A3DA', 'carousel_pagination_size' => '12px', 'item_border_style' => 'solid', 'item_border_color' => '#e1e1e1', 'item_border_width' => '1px', 'row_separator_color' => '#e1e1e1', 'row_separator_height' => '20px', 'row_separator_border_style' => 'solid', 'hide_thumbnail' => '1', 'thumbnail_background_color' => '#ffffff', 'thumbnail_border_style' => 'solid', 'thumbnail_border_color' => '#e1e1e1', 'thumbnail_border_width' => '1px', 'thumbnail_border_radius' => '3px', 'thumbnail_padding' => '', 'thumbnail_margin' => '', 'thumbnail_width' => '', 'thumbnail_height' => '', 'hide_title' => '1', 'title_align' => 'center', 'title_color' => '#47A3DA', 'title_hover_color' => '#98D2F7', 'title_font_size' => '14px', 'title_padding' => '', 'title_margin' => '', 'show_excerpt' => '', 'excerpt_length' => '15', 'excerpt_align' => '', 'excerpt_color' => '#333333', 'excerpt_font_size' => '12px', 'excerpt_padding' => '', 'excerpt_margin' => '', 'hide_price' => '1', 'price_color' => '#47A3DA', 'no_discount_price_color' => '#333333', 'price_font_size' => '14px', 'no_discount_price_font_size' => '12px', 'price_padding' => '', 'price_margin' => '', 'hide_addtocart' => '1', 'addtocart_text' => 'Add to cart', 'addtocart_color' => '', 'addtocart_font_size' => '14px', 'addtocart_padding' => '', 'addtocart_margin' => '', 'add_cart_price_style' => '2column', 'show_rating' => '1', 'show_sale_flash' => '1', 'el_class' => ''), $atts)); $inline_style = ' #' . $id . ' .dhvc-woo-heading { color:' . $heading_color . '; font-size:' . $heading_font_size . '; } #' . $id . ' .dhvc-woo-item { border: ' . $item_border_width . ' ' . $item_border_style . ' ' . $item_border_color . '; } #' . $id . ' .dhvc-woo-separator{ border-top-color:' . $row_separator_color . '; margin-top:' . absint($row_separator_height) / 2 . 'px; margin-bottom:' . absint($row_separator_height) / 2 . 'px; border-top-style:' . $row_separator_border_style . '; } #' . $id . ' .dhvc-woo-images{ background-color:' . $thumbnail_background_color . '; } #' . $id . ' .dhvc-woo-images img{ border-style:' . $thumbnail_border_style . '; border-width:' . $thumbnail_border_width . '; border-color:' . $thumbnail_border_color . '; border-radius:' . $thumbnail_border_radius . '; -webkit-border-radius:' . $thumbnail_border_radius . '; padding:' . $thumbnail_padding . '; margin:' . $thumbnail_margin . '; } #' . $id . ' .dhvc-woo-title{ text-align:' . $title_align . '; padding:' . $title_padding . '; margin:' . $title_margin . '; } #' . $id . ' .dhvc-woo-title a{ color:' . $title_color . '; font-size:' . $title_font_size . '; } #' . $id . ' .dhvc-woo-title a:hover{ color:' . $title_hover_color . ' } #' . $id . ' .dhvc-woo-excerpt{ text-align:' . $excerpt_align . '; color:' . $excerpt_color . '; font-size:' . $excerpt_font_size . '; padding:' . $excerpt_padding . '; margin:' . $excerpt_margin . '; } #' . $id . ' .dhvc-woo-price{ padding:' . $price_padding . '; margin:' . $price_margin . '; } #' . $id . ' .dhvc-woo-price .amount, #' . $id . ' .dhvc-woo-price ins .amount{ color:' . $price_color . '; font-size:' . $price_font_size . '; } #' . $id . ' .dhvc-woo-price del .amount{ color:' . $no_discount_price_color . '; font-size:' . $no_discount_price_font_size . ' } #' . $id . ' .dhvc-woo-addtocart a{ padding:' . $addtocart_padding . '; margin:' . $addtocart_margin . '; } #' . $id . ' .dhvc-woo-masonry-list .dhvc-woo-masonry-item{ margin-bottom:' . absint($masonry_gutter) . 'px; } #' . $id . ' .dhvc-woo-filters a { border-color:' . $masonry_filters_border_color . '; background-color:' . $masonry_filters_background . '; color:' . $masonry_filters_color . '; } #' . $id . ' .dhvc-woo-filters a.selected, #' . $id . ' .dhvc-woo-filters a:hover{ background-color:' . $masonry_filters_selected_background . '; color:' . $masonry_filters_selected_color . '; border-color:' . $masonry_filters_selected_border_color . '; } #' . $id . ' .dhvc-woo-carousel-arrows a{ background:' . $carousel_arrow_background . '; width:' . $carousel_arrow_size . '; height:' . $carousel_arrow_size . '; border-radius:' . $carousel_arrow_border_radius . '; -webkit-border-radius:' . $carousel_arrow_border_radius . '; } #' . $id . ' .dhvc-woo-carousel-arrows a:hover{ background:' . $carousel_arrow_hover_background . '; } #' . $id . ' .dhvc-woo-carousel-arrows a i{ color:' . $carousel_arrow_color . '; font-size:' . $carousel_arrow_front_size . '; } #' . $id . ' .dhvc-woo-carousel-arrows a:hover i{ color:' . $carousel_arrow_hover_color . '; } #' . $id . ' .owl-controls .owl-page span{ width:' . $carousel_pagination_size . '; height:' . $carousel_pagination_size . '; background:' . $carousel_pagination_background . '; } #' . $id . ' .owl-controls .owl-page.active span, #' . $id . ' .owl-controls.clickable .owl-page:hover span{ background:' . $carousel_pagination_active_background . '; } '; if (defined('YITH_WCWL')) { $label = apply_filters('yith_wcwl_button_label', get_option('yith_wcwl_add_to_wishlist_text')); $br = apply_filters('yith-wcwl-browse-wishlist-label', __('Browse Wishlist', 'yit')); $inline_style .= '#' . $id . ' .dhvc-woo-images .add_to_wishlist:after{ content:"' . $label . '"; } #' . $id . ' .dhvc-woo-images .yith-wcwl-wishlistexistsbrowse a:after, #' . $id . ' .dhvc-woo-images .yith-wcwl-wishlistaddedbrowse a:after{ content:"' . $br . '"; } '; } //wp_enqueue_style('dhvc-woo'); global $woocommerce, $product, $wp_the_query; $posts_per_page = $posts_per_page; $show = sanitize_title($show); $orderby = sanitize_title($orderby); $order = sanitize_title($order); if (is_front_page()) { $paged = get_query_var('page') ? get_query_var('page') : 1; } else { $paged = get_query_var('paged') ? get_query_var('paged') : 1; } $query_args = array('paged' => $paged, 'posts_per_page' => $posts_per_page, 'post_status' => 'publish', 'post_type' => 'product', 'offset' => 0, 'order' => $order == 'asc' ? 'ASC' : 'DESC'); if ($query_type == '1') { if (!empty($products)) { $products_ids = explode(',', $products); $query_args['post__in'] = $products_ids; } if (!empty($exclude_products)) { $exclude_products_ids = explode(',', $exclude_products); $query_args[' post__not_in'] = $exclude_products_ids; } $categories = array(); if (is_product()) { $cat_terms = get_the_terms($product->id, 'product_cat'); if ($cat_terms) { foreach ($cat_terms as $cat) { $categories[] = $cat->term_id; } } } if (!empty($category)) { $category = str_replace('-1', implode(',', $categories), $category); $query_args['tax_query'][] = array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => explode(',', $category), 'operator' => 'IN'); } if (!empty($exclude_category)) { $exclude_category = str_replace('-1', implode(',', $categories), $exclude_category); $query_args['tax_query'][] = array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => explode(',', $exclude_category), 'operator' => 'NOT IN'); } if (!empty($brand)) { $query_args['tax_query'][] = array('taxonomy' => 'product_brand', 'field' => 'id', 'terms' => explode(',', $brand), 'operator' => 'IN'); } if (!empty($exclude_brand)) { $query_args['tax_query'][] = array('taxonomy' => 'product_brand', 'field' => 'id', 'terms' => explode(',', $exclude_brand), 'operator' => 'NOT IN'); } if (!empty($tag)) { $query_args['tax_query'][] = array('taxonomy' => 'product_tag', 'field' => 'id', 'terms' => explode(',', $tag), 'operator' => 'IN'); } if (!empty($exclude_tag)) { $query_args['tax_query'][] = array('taxonomy' => 'product_tag', 'field' => 'id', 'terms' => explode(',', $exclude_tag), 'operator' => 'NOT IN'); } if (!empty($attribute)) { $attribute_arr = explode(',', $attribute); $t = array(); foreach ($attribute_arr as $attr) { $attr_arr = explode('|', $attr); $t[$attr_arr[0]][] = $attr_arr[1]; } if (!empty($t)) { foreach ($t as $key => $tarr) { $query_args['tax_query'][] = array('taxonomy' => $key, 'field' => 'slug', 'terms' => $tarr, 'operator' => 'IN'); } } } } if ($query_type == 'upsell') { $query_args = $this->_get_upsell_product($query_args); if (empty($query_args)) { return; } } if ($query_type == 'related') { $query_args = $this->_get_related_product($query_args); if (empty($query_args)) { return; } } if ($query_type == 'crosssell') { $query_args = $this->_get_crosssell_product($query_args); if (empty($query_args)) { return; } } $query_args['meta_query'] = array(); if ($show_hidden == '0') { $query_args['meta_query'][] = array('key' => '_visibility', 'value' => array('visible', 'catalog'), 'compare' => 'IN'); $query_args['post_parent'] = 0; } if (!empty($hide_free)) { $query_args['meta_query'][] = array('key' => '_price', 'value' => 0, 'compare' => '>', 'type' => 'DECIMAL'); } $stock_status = array(); if (get_option('woocommerce_hide_out_of_stock_items') == 'yes') { $stock_status = array('key' => '_stock_status', 'value' => 'instock', 'compare' => '='); } $query_args['meta_query'][] = $stock_status; $query_args['meta_query'] = array_filter($query_args['meta_query']); switch ($show) { case 'featured': $query_args['meta_query'][] = array('key' => '_featured', 'value' => 'yes'); break; case 'onsale': $product_ids_on_sale = wc_get_product_ids_on_sale(); $product_ids_on_sale[] = 0; $query_args['post__in'] = $product_ids_on_sale; break; } if (isset($_GET['orderby']) && !empty($_GET['orderby'])) { $orderby = sanitize_text_field($_GET['orderby']); } $query_args['order'] = $order; switch ($orderby) { case 'title': $query_args['orderby'] = 'title'; break; case 'modified': $query_args['orderby'] = 'modified'; break; case 'comment_count': $query_args['orderby'] = 'comment_count'; break; case 'popularity': $args['meta_key'] = 'total_sales'; // Sorting handled later though a hook add_filter('posts_clauses', array($woocommerce->query, 'order_by_popularity_post_clauses')); break; case 'rating': // Sorting handled later though a hook add_filter('posts_clauses', array($woocommerce->query, 'order_by_rating_post_clauses')); break; case 'date': $query_args['orderby'] = 'date'; //$query_args['order'] = 'ASC' ? 'ASC' : 'DESC'; break; case 'rand': $query_args['orderby'] = 'rand'; break; case 'sales': $query_args['meta_key'] = 'total_sales'; $query_args['orderby'] = 'meta_value_num'; break; case 'price': $query_args['meta_key'] = '_price'; $query_args['orderby'] = 'meta_value_num'; $query_args['order'] = 'asc'; break; case 'price-desc': $query_args['meta_key'] = '_price'; $query_args['orderby'] = 'meta_value_num'; $query_args['order'] = 'desc'; break; default: $ordering_args = $woocommerce->query->get_catalog_ordering_args($orderby, $order); $query_args['orderby'] = $ordering_args['orderby']; //$query_args['order'] =$ordering_args['order']; break; } $query_args = apply_filters('dhvc_woo_query_args', $query_args, $atts, $content); $r = new WP_Query($query_args); $output = ''; if (defined('WPB_VC_VERSION') && function_exists('vc_add_param')) { if (!dhvc_is_editor() && !dhvc_is_editor()) { //wp_add_inline_style('dhvc-woo',$inline_style); $output .= '<style type="text/css">' . $inline_style . '</style>'; } else { $output .= '<style type="text/css">' . $inline_style . '</style>'; } } else { //wp_add_inline_style('dhvc-woo',$inline_style); $output .= '<style type="text/css">' . $inline_style . '</style>'; } // wp_enqueue_style('dhvc-woo-font-awesome'); // wp_enqueue_style('dhvc-woo-chosen'); // wp_enqueue_style('dhvc-woo'); $output .= '<div id="' . $id . '" class="woocommerce dhvc-woo ' . $el_class . '">'; if (!empty($heading)) { $output .= '<div class="dhvc-woo-heading">'; $output .= $heading; $output .= '</div>'; } if ($display == 'masonry' && $show_masonry_filter !== '0') { $output .= '<div class="dhvc-woo-filters dhvc-woo-clearfix">'; $output .= '<ul data-option-key="filter">'; $output .= '<li>'; $output .= '<a class="dhvc-woo-filter selected" href="#" data-option-value="*">' . __('All', DHVC_WOO) . '</a>'; $output .= '</li>'; $product_cats = array(); if ($r->have_posts()) { while ($r->have_posts()) { $r->the_post(); global $product; $cats = get_the_terms($product->id, 'product_cat'); if (!empty($cats)) { foreach ($cats as $cat) { $product_cats[$cat->term_id] = $cat->name; } } } foreach ($product_cats as $term_id => $name) { $output .= '<li>'; $output .= '<a href="#" class="dhvc-woo-filter" data-option-value= ".dhvc-woo-cat-' . $term_id . '">' . $name . '</a>'; $output .= '</li>'; } wp_reset_postdata(); wp_reset_query(); } $output .= '</ul>'; $output .= '</div>'; } if ($display == 'carousel' && $hide_carousel_arrows === '0' && $r->post_count > $post_per_row) { $output .= '<div class="dhvc-woo-carousel-arrows dhvc-woo-clearfix">'; $output .= '<a href="#" class="dhvc-woo-carousel-prev"><i class="fa fa-chevron-left"></i></a>'; $output .= '<a href="#" class="dhvc-woo-carousel-next"><i class="fa fa-chevron-right"></i></a>'; $output .= '</div>'; } if ($display != 'carousel' && $display != 'masonry') { if (empty($hide_result_count) || empty($hide_ordering_list)) { $output .= '<div class="dhvc-woo-row-fluid dhvc-woo-toolbar">'; if (empty($hide_result_count)) { ob_start(); dhvc_result_count($r); $output .= ob_get_clean(); } if (empty($hide_ordering_list)) { ob_start(); dhvc_woo_orderby($orderby); $output .= ob_get_clean(); } $output .= '</div>'; } } $output .= '<div class="dhvc-woo-row-fluid dhvc-woo-' . $display . '-list"' . ($display == 'masonry' ? ' data-masonry-gutter="' . absint($masonry_gutter) . '"' : '') . '' . ($display == 'carousel' ? ' data-items="' . absint($post_per_row) . '"' : '') . ($display == 'carousel' && !empty($show_carousel_pagination) ? ' data-pagination="true"' : '') . '>'; if ($r->have_posts()) { $i = 0; while ($r->have_posts()) { $r->the_post(); global $product, $post; $cats = get_the_terms($product->id, 'product_cat'); $product_cats = array(); if (!empty($cats)) { foreach ($cats as $cat) { $product_cats[] = 'dhvc-woo-cat-' . $cat->term_id; } } if ($display == 'grid') { if ($i++ % $post_per_row == 0) { $output .= '<div class="dhvc-woo-row-fluid">'; } } $output .= '<div class="dhvc-woo-item'; if ($display != 'carousel' && $display != 'list') { $output .= ' dhvc-woo-span' . 12 / absint($post_per_row); } $output .= ' dhvc-woo-' . $display . '-item ' . implode(' ', $product_cats); $output .= '">'; $output_image = ''; if ($hide_thumbnail !== '0') { $output_image .= '<div class="dhvc-woo-images">'; if (defined('YITH_WCWL')) { $output_image .= do_shortcode('[yith_wcwl_add_to_wishlist]'); } if ($show_sale_flash !== '0' && $product->is_on_sale()) { ob_start(); woocommerce_show_product_loop_sale_flash(); $output_image .= ob_get_clean(); } if (function_exists('dhwcpl_product_sale')) { ob_start(); dhwcpl_product_sale(); dhwcpl_product_out_of_store(); dhwcpl_shop_loop_item(); $output_image .= ob_get_clean(); } if (has_post_thumbnail()) { $image_title = esc_attr(get_the_title(get_post_thumbnail_id())); $image_link = esc_url(get_permalink()); $thumb_size = 'shop_catalog'; $thumbnail_image = get_the_post_thumbnail($post->ID, 'shop_catalog'); if (!empty($thumbnail_height) && !empty($thumbnail_width)) { $thumb_size = $thumbnail_width . 'x' . $thumbnail_height; $thumbnail_data = dhvc_woo_getImageBySize(array('post_id' => $product->id, 'thumb_size' => $thumb_size)); $thumbnail_image = $thumbnail_data['thumbnail']; } $output_image .= '<a href="' . $image_link . '" itemprop="image" title="' . $image_title . '" >' . $thumbnail_image . '</a>'; } else { $output_image .= apply_filters('woocommerce_single_product_image_html', sprintf('<a href="%s" itemprop="image" title="%s"><img src="%s" alt="Placeholder" /></a>', esc_url(get_permalink()), $image_title, wc_placeholder_img_src()), $product->id); } $output_image .= '</div>'; } $output .= apply_filters('dhvc_woo_images', $output_image, $product, $display); $output .= '<div class="dhvc-woo-info"'; $image_config_size = absint($thumbnail_width); if (empty($image_config_size)) { $shop_single_image_arr = wc_get_image_size('shop_single'); $image_config_size = $shop_single_image_arr['width']; } $image_config_size = $image_config_size + absint($thumbnail_border_width) + absint($thumbnail_border_width); if ($display == 'list') { $output .= 'style="width: calc(100% - ' . $image_config_size . 'px);"'; } $output .= '>'; $output_title = ''; if ($hide_title !== '0') { $output_title .= '<h2 class="dhvc-woo-title dhvc-woo-clearfix">'; $output_title .= '<a href="' . get_permalink() . '">' . the_title('', '', false) . '</a>'; $output_title .= '</h2>'; } $output .= apply_filters('dhvc_woo_title', $output_title, $product, $display); $output_excerpt = ''; if (!empty($show_excerpt)) { $output_excerpt .= '<div class="dhvc-woo-excerpt">'; $output_excerpt .= apply_filters('dhvc-woo-excerpt', wp_trim_words($post->post_excerpt, $excerpt_length), $post); $output_excerpt .= '</div>'; } $output .= apply_filters('dhvc_woo_excerpt', $output_excerpt, $product, $display); $output_rating = ''; if ($show_rating !== '0') { $output_rating .= '<div class="woocommerce dhvc-woo-rating dhvc-woo-clearfix">'; $rating = $product->get_average_rating(); $rating = absint($rating); $rating_html = '<div class="star-rating" title="' . sprintf(__('Rated %s out of 5', 'woocommerce'), $rating) . '">'; $rating_html .= '<span style="width:' . $rating / 5 * 100 . '%"><strong class="rating">' . $rating . '</strong> ' . __('out of 5', 'woocommerce') . '</span>'; $rating_html .= '</div>'; $output_rating .= $rating_html; $output_rating .= '</div>'; } $output .= apply_filters('dhvc_woo_rating', $output_rating, $product, $display); $output .= '<div class="dhvc-woo-extra dhvc-woo-row-fluid">'; if ($display == 'list') { $output_price = ''; if ($hide_price !== '0') { $output_price .= '<div class="dhvc-woo-price">'; $output_price .= $product->get_price_html(); $output_price .= '</div>'; } $output .= apply_filters('dhvc_woo_price', $output_price, $product, $display); $output_addtocart = ''; if ($hide_addtocart !== '0') { $output_addtocart .= '<div class="dhvc-woo-addtocart">'; ob_start(); wc_get_template('loop/add-to-cart.php'); $add_to_cart = ob_get_clean(); $output_addtocart .= apply_filters('dhvc-woo-add-to-cart', $add_to_cart, $product); $output_addtocart .= '</div>'; } $output .= apply_filters('dhvc_woo_addtocart', $output_addtocart, $product, $display); } else { //'add_cart_price_style'=>'2column', if ($add_cart_price_style == '1column') { $output_price = ''; if ($hide_price !== '0') { $output_price .= '<div class="dhvc-woo-price dhvc-woo-span12">'; $output_price .= $product->get_price_html(); $output_price .= '</div>'; } $output .= apply_filters('dhvc_woo_price', $output_price, $product, $display); $output_addtocart = ''; if ($hide_addtocart !== '0') { $output_addtocart .= '<div class="dhvc-woo-addtocart dhvc-woo-span12">'; ob_start(); wc_get_template('loop/add-to-cart.php'); $add_to_cart = ob_get_clean(); $output_addtocart .= apply_filters('dhvc-woo-add-to-cart', $add_to_cart, $product); $output_addtocart .= '</div>'; } $output .= apply_filters('dhvc_woo_addtocart', $output_addtocart, $product, $display); } else { $output_addtocart = ''; if ($hide_addtocart !== '0') { $output_addtocart .= '<div class="dhvc-woo-addtocart dhvc-woo-span6">'; ob_start(); wc_get_template('loop/add-to-cart.php'); $add_to_cart = ob_get_clean(); $output_addtocart .= apply_filters('dhvc-woo-add-to-cart', $add_to_cart, $product); $output_addtocart .= '</div>'; } $output .= apply_filters('dhvc_woo_addtocart', $output_addtocart, $product, $display); $output_price = ''; if ($hide_price !== '0') { $output_price .= '<div class="dhvc-woo-price dhvc-woo-span6">'; $output_price .= $product->get_price_html(); $output_price .= '</div>'; } $output .= apply_filters('dhvc_woo_price', $output_price, $product, $display); } } $output .= '</div>'; $output .= '</div>'; $output .= '</div>'; if ($display == 'grid') { if ($i % $post_per_row == 0 || $i == $r->post_count) { $output .= '</div>'; $output .= '<div class="dhvc-woo-separator"></div>'; } } } } $output .= '</div>'; if (!empty($show_grid_pagination) && $display != 'carousel' && $display != 'masonry') { $pagination = dhvc_woo_pagination(array('echo' => false), $r); $output .= $pagination; } $output .= '</div>'; wp_reset_postdata(); wp_reset_query(); return $output; }
echo $itemsize; ?> <?php echo strtolower($tax); ?> kad_product"> <div <?php post_class($classes); ?> > <?php do_action('woocommerce_before_shop_loop_item'); ?> <?php echo woocommerce_show_product_loop_sale_flash($post, $product); ?> <a href="<?php the_permalink(); ?> " class="product_item_link product_img_link"> <?php /** * woocommerce_before_shop_loop_item_title hook * * @hooked woocommerce_show_product_loop_sale_flash - 10 * @hooked woocommerce_template_loop_product_thumbnail - 10 */ do_action('woocommerce_before_shop_loop_item_title'); ?>
function thb_loop_product_start() { global $product; echo "<div class='thb-product-image-wrapper item-thumb'>"; echo "<a href='" . get_permalink() . "'>"; woocommerce_show_product_loop_sale_flash(); if (!$product->is_in_stock()) { echo "<span class='thb-out-of-stock'>"; _e('Out of stock', 'woocommerce'); echo "</span>"; } echo "<span class='thb-overlay'></span>"; woocommerce_template_loop_product_thumbnail(); echo "</a>"; echo "</div>"; echo "<div class='thb-product-description'>"; }
/** * * Product thumbnail for loop */ function woo_loop_product_thumbnail() { if (has_post_thumbnail()) { echo '<figure class="featured-image img-preload img-hover">'; echo '<a href="' . get_permalink() . '">'; the_post_thumbnail('shop_catalog'); echo '<div class="overlay"></div>'; echo '</a>'; woocommerce_template_loop_add_to_cart(); woocommerce_show_product_loop_sale_flash(); echo '</figure>'; } }
function kt_group_flash() { ?> <div class="status"> <?php kt_show_product_loop_new_flash(); woocommerce_show_product_loop_sale_flash(); ?> </div> <?php }
function venedor_woocommerce_thumbnail() { global $product, $woocommerce, $venedor_settings; $id = get_the_ID(); $size = 'shop_catalog'; $gallery = get_post_meta($id, '_product_image_gallery', true); $attachment_image = ''; if ($venedor_settings['category-image-effect'] && !empty($gallery)) { $gallery = explode(',', $gallery); $first_image_id = $gallery[0]; $attachment_image = wp_get_attachment_image($first_image_id, $size, false, array('class' => 'hover-image')); } $thumb_image = get_the_post_thumbnail($id, $size); $class = "product-image"; if (!$thumb_image) { if (wc_placeholder_img_src()) { $thumb_image = wc_placeholder_img($size); } } if (!$attachment_image || !$venedor_settings['category-image-effect']) { $class = "product-image no-image"; } echo '<span class="' . $class . '">'; // show images echo $attachment_image; echo $thumb_image; // show hot/sale label woocommerce_show_product_loop_sale_flash(); // show price if ($venedor_settings['product-price']) { if ($product->get_price() != '') { $variable_class = ''; if ($product->is_type(array('variable')) && $product->get_variation_price('min') !== $product->get_variation_price('max')) { $variable_class = ' price-variable'; } if ($product->is_type(array('grouped'))) { $child_prices = array(); foreach ($product->get_children() as $child_id) { $child_prices[] = get_post_meta($child_id, '_price', true); } $child_prices = array_unique($child_prices); if (!empty($child_prices)) { $variable_class = ' price-variable'; } } echo '<div class="price-box ' . $venedor_settings['product-price-pos'] . $variable_class . '">'; woocommerce_template_loop_price(); echo '</div>'; } } // show quick view if ($venedor_settings['category-quickview']) { ?> <div class="figcaption<?php if (!$venedor_settings['category-hover']) { echo ' no-hover'; } ?> "> <span class="btn btn-arrow quickview-button <?php echo $venedor_settings['category-quickview-pos']; ?> " data-id="<?php echo the_ID(); ?> "><span class="fa fa-search"></span></span> </div> <?php } echo '</span>'; }