function waxom_woocommerce_loop_thumbnail() { echo '<div class="product-thumbnail-wrap vntd-accent-bg-color">'; woocommerce_template_loop_product_thumbnail(); echo '<div class="product-overlay">'; echo '<div class="product-overlay-inner">'; woocommerce_template_loop_add_to_cart(); echo '</div></div></div>'; echo '<div class="product-details-wrap"><div class="product-category">' . waxom_product_categories() . '</div>'; }
function vntd_woocommerce_loop_thumbnail() { echo '<div class="product-thumbnail-wrap">'; woocommerce_template_loop_product_thumbnail(); echo '<div class="product-overlay-add">'; woocommerce_template_loop_add_to_cart(); echo '</div></div>'; }
/** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget($args, $instance) { echo $args['before_widget']; if (!empty($instance['title'])) { echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title']; } $args = array('post_type' => 'product', 'product_cat' => 'mais-vendidas', 'orderby' => 'rand'); $loop = new WP_Query($args); ?> <div class="wiget-carouser"> <div class="passdor-widget"> <a class="" href="#carousel-mais-vendidas-widget" role="button" data-slide="prev"><img src="<?php echo get_template_directory_uri(); ?> /img/passador/seta-esq.png" ></a> <a class="" href="#carousel-mais-vendidas-widget" role="button" data-slide="next"><img src="<?php echo get_template_directory_uri(); ?> /img/passador/seta-dir.png" ></a> </div> <div id="carousel-mais-vendidas-widget" class="carousel slide" data-ride="carousel" > <div class="carousel-inner" role="listbox"> <?php while ($loop->have_posts()) { $loop->the_post(); ?> <div class="item <?php echo $loop->current_post == 0 ? 'active' : ''; ?> "> <a href="<?php the_permalink(); ?> "> <?php woocommerce_template_loop_product_thumbnail(); ?> </a> </div> <?php } ?> </div> </div> </div> <?php wp_reset_postdata(); echo $args['after_widget']; }
function kt_template_loop_product_thumbnail() { global $product; $thumb_inner_class = array('thumb-inner'); $kt_using_two_image = kt_option('kt_using_two_image', 'yes'); $back_image = ''; if ($kt_using_two_image == "yes") { $attachment_ids = $product->get_gallery_attachment_ids(); if ($attachment_ids) { $back_image = wp_get_attachment_image($attachment_ids[0], 'shop_catalog'); } if ($back_image) { $thumb_inner_class[] = 'has-back-image'; } } ob_start(); ?> <div class="<?php echo esc_attr(implode(' ', $thumb_inner_class)); ?> "> <a href="<?php the_permalink(); ?> "> <?php if ($back_image) { ?> <span class="back-image"><?php echo $back_image; ?> </span> <?php } ?> <?php echo woocommerce_template_loop_product_thumbnail(); ?> </a> </div> <?php echo ob_get_clean(); }
function show_product_gallery_archive() { global $post, $product, $woocommerce; $small_thumbnail_size = apply_filters('single_product_small_thumbnail_size', 'shop_catalog'); $enabled_archives = get_option('woocommerce_product_gallery_slider_archives_enabled'); $enabled_for_post_archive = get_post_meta($post->ID, '_woocommerce_product_gallery_slider_archives_enabled', true); if ($enabled_archives == 'yes' && $enabled_for_post_archive !== 'no' || $enabled_archives == 'no' && $enabled_for_post_archive == 'yes') { $attachments = $product->get_gallery_attachment_ids(); $post_title = esc_attr(get_the_title($post->ID)); if ($attachments) { $loop = 0; $columns = apply_filters('woocommerce_product_thumbnails_columns', 3); echo '<div class="product-gallery"><ul class="slides">'; if (has_post_thumbnail()) { $small_image_url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'shop_thumbnail'); $large_image_url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'shop_single'); echo '<li data-thumb="' . $small_image_url[0] . '"><a href="' . get_permalink($post->ID) . '" title="' . $post_title . '" rel="thumbnails" class="zoom ">' . get_the_post_thumbnail($post->ID, 'shop_single') . '</a></li>'; } foreach ($attachments as $attachment_id) { if (get_post_meta($attachment_id, '_woocommerce_exclude_image', true) == 1) { continue; } $url = wp_get_attachment_image_src($attachment_id, 'shop_thumbnail'); $image = wp_get_attachment_image($attachment_id, $small_thumbnail_size); echo '<li data-thumb="' . $url[0] . '"><a href="' . get_permalink($post->ID) . '" title="' . $post_title . '">' . $image . '</a></li>'; } echo '</ul></div>'; } else { woocommerce_template_loop_product_thumbnail(); } } else { echo '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(get_the_title($post->ID)) . '" rel="thumbnails" class="zoom">'; woocommerce_template_loop_product_thumbnail(); echo '</a>'; } }
/** * Display woocommerce_template_loop_product_thumbnail() wrapped with 'a' tag. * * @param string $class */ function presscore_wc_template_loop_product_thumbnail($class = '') { ob_start(); woocommerce_template_loop_product_thumbnail(); $img = ob_get_contents(); ob_end_clean(); $img = str_replace('wp-post-image', 'wp-post-image preload-me', $img); echo '<a href="' . get_permalink() . '" class="' . esc_attr($class) . '">' . $img . '</a>'; }
$attachment_ids = $product->get_gallery_attachment_ids(); $img_count = 0; if ($attachment_ids) { foreach ($attachment_ids as $attachment_id) { if (sf_get_post_meta($attachment_id, '_woocommerce_exclude_image', true)) { continue; } echo '<div class="img-wrap second-image">' . wp_get_attachment_image($attachment_id, 'shop_catalog') . '</div>'; $img_count++; if ($img_count == 1) { break; } } } else { echo '<div class="img-wrap second-image">'; woocommerce_template_loop_product_thumbnail(); echo '</div>'; } } } } ?> <?php if (!$sf_catalog_mode) { ?> <div class="cart-overlay"> <div class="shop-actions clearfix"> <?php do_action('woocommerce_after_shop_loop_item'); ?>
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'>"; }
function kt_woocommerce_template_loop_product_thumbnail() { global $pinnacle, $woocommerce_loop, $post; // Store column count for displaying the grid if (empty($woocommerce_loop['columns'])) { $woocommerce_loop['columns'] = apply_filters('loop_shop_columns', 4); } $product_column = $woocommerce_loop['columns']; if ($product_column == '3') { $productimgwidth = 400; } else { if ($product_column == '5') { $productimgwidth = 240; } else { $productimgwidth = 300; } } if (isset($pinnacle['product_img_resize']) && $pinnacle['product_img_resize'] == 0) { $resizeimage = 0; } else { $resizeimage = 1; $productimgheight = $productimgwidth; } if ($resizeimage == 1) { echo '<div class="kad-product-noflipper">'; if (has_post_thumbnail()) { $product_image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); $product_image_url = $product_image[0]; $image_product = aq_resize($product_image_url, $productimgwidth, $productimgheight, true); if (empty($image_product)) { $image_product = $product_image_url; } ?> <img width="<?php echo esc_attr($productimgwidth); ?> " height="<?php echo esc_attr($productimgheight); ?> " src="<?php echo esc_attr($image_product); ?> " class="attachment-shop_catalog wp-post-image" alt="<?php the_title(); ?> "> <?php } echo '</div>'; } else { echo '<div class="kad-woo-image-size">'; echo woocommerce_template_loop_product_thumbnail(); echo '</div>'; } }
public function thumbnail_wrapper() { echo '<figure class="entry-featured-media">'; echo '<a href="' . apply_filters('the_permalink', get_permalink()) . '" class="g1-frame g1-frame--none g1-frame--inherit g1-frame--center">'; echo '<span class="g1-decorator">'; woocommerce_template_loop_product_thumbnail(); echo '<span class="g1-indicator g1-indicator-document"></span>'; echo '</span>'; echo '</a>'; echo '</figure>'; }
function kt_woocommerce_template_loop_product_thumbnail() { global $virtue, $woocommerce_loop, $post; // Store column count for displaying the grid if (empty($woocommerce_loop['columns'])) { $woocommerce_loop['columns'] = apply_filters('loop_shop_columns', 4); } if ($woocommerce_loop['columns'] == '3') { $productimgwidth = 365; } else { $productimgwidth = 268; } if (isset($virtue['product_img_resize']) && $virtue['product_img_resize'] == 0) { $resizeimage = 0; } else { $resizeimage = 1; } if ($resizeimage == 1) { if (has_post_thumbnail()) { $image_id = get_post_thumbnail_id($post->ID); $product_image_array = wp_get_attachment_image_src($image_id, 'full'); $product_image_url = $product_image_array[0]; // Make sure there is a copped image to output $image_product = aq_resize($product_image_url, $productimgwidth, $productimgwidth, true); if (empty($image_product)) { $image_product = $product_image_url; } // Get srcset $image_meta = get_post_meta($image_id, '_wp_attachment_metadata', true); $img_srcset = wp_calculate_image_srcset(array($productimgwidth, $productimgheight), $product_image_url, $image_meta, $image_id); // Get alt and fall back to title if no alt $alt_text = get_post_meta($image_id, '_wp_attachment_image_alt', true); if (empty($alt_text)) { $alt_text = get_the_title(); } ?> <img width="<?php echo esc_attr($productimgwidth); ?> " height="<?php echo esc_attr($productimgheight); ?> " src="<?php echo esc_url($image_product); ?> " <?php if (!empty($img_srcset)) { ?> srcset="<?php echo esc_attr($img_srcset); ?> " sizes="(max-width: <?php echo esc_attr($productimgwidth); ?> px) 100vw, <?php echo esc_attr($productimgwidth); ?> px" <?php } ?> class="attachment-shop_catalog size-<?php echo esc_attr($productimgwidth . 'x' . $productimgheight); ?> wp-post-image" alt="<?php echo esc_attr($alt_text); ?> "> <?php } elseif (woocommerce_placeholder_img_src()) { echo woocommerce_placeholder_img('shop_catalog'); } } else { echo '<div class="kad-woo-image-size">'; echo woocommerce_template_loop_product_thumbnail(); echo '</div>'; } }
function kt_woocommerce_template_loop_product_thumbnail() { global $product, $woocommerce_loop, $pinnacle, $post; $product_column = $woocommerce_loop['columns']; if ($product_column == '1') { $productimgwidth = 400; } else { if ($product_column == '2') { $productimgwidth = 560; } else { if ($product_column == '3') { $productimgwidth = 400; } else { if ($product_column == '6') { $productimgwidth = 240; } else { if ($product_column == '5') { $productimgwidth = 240; } else { $productimgwidth = 300; } } } } } if (isset($pinnacle['product_img_flip']) && $pinnacle['product_img_flip'] == 0) { $productimgflip = 0; } else { $productimgflip = 1; } if (isset($pinnacle['product_img_resize']) && $pinnacle['product_img_resize'] == 0) { $resizeimage = 0; } else { $resizeimage = 1; if (isset($pinnacle['shop_img_ratio'])) { $img_ratio = $pinnacle['shop_img_ratio']; } else { $img_ratio = 'square'; } if ($img_ratio == 'portrait') { $tempproductimgheight = $productimgwidth * 1.35; $productimgheight = floor($tempproductimgheight); } else { if ($img_ratio == 'landscape') { $tempproductimgheight = $productimgwidth / 1.35; $productimgheight = floor($tempproductimgheight); } else { if ($img_ratio == 'widelandscape') { $tempproductimgheight = $productimgwidth / 2; $productimgheight = floor($tempproductimgheight); } else { $productimgheight = $productimgwidth; } } } } if ($productimgflip == 1 && $resizeimage == 1) { $attachment_ids = $product->get_gallery_attachment_ids(); if ($attachment_ids) { $flipclass = "kad-product-flipper"; } else { $flipclass = "kad-product-noflipper"; } echo '<div class="' . $flipclass . '">'; if (has_post_thumbnail()) { $product_image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); $product_image_url = $product_image[0]; } else { $product_image_url = wc_placeholder_img_src(); } $image_product = aq_resize($product_image_url, $productimgwidth, $productimgheight, true); if (empty($image_product)) { $image_product = $product_image_url; } ?> <div class="kad_img_flip image_flip_front"><img width="<?php echo $productimgwidth; ?> " height="<?php echo $productimgheight; ?> " src="<?php echo $image_product; ?> " class="attachment-shop_catalog wp-post-image" alt="<?php the_title(); ?> "></div> <?php if ($attachment_ids) { $secondary_image_id = $attachment_ids['0']; $second_product_image_url = wp_get_attachment_image_src($secondary_image_id, 'full'); $second_product_image_url = $second_product_image_url[0]; $second_image_product = aq_resize($second_product_image_url, $productimgwidth, $productimgheight, true); if (empty($second_image_product)) { $second_image_product = $second_product_image_url; } echo '<div class="kad_img_flip image_flip_back"><img width="' . $productimgwidth . '" height="' . $productimgheight . '" src="' . $second_image_product . '" class="attachment-shop_catalog wp-post-image" alt="' . get_the_title() . '"></div>'; } echo '</div>'; } else { if ($resizeimage == 1) { echo '<div class="kad-product-noflipper">'; if (has_post_thumbnail()) { $product_image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); $product_image_url = $product_image[0]; } else { $product_image_url = wc_placeholder_img_src(); } $image_product = aq_resize($product_image_url, $productimgwidth, $productimgheight, true); if (empty($image_product)) { $image_product = $product_image_url; } ?> <img width="<?php echo esc_attr($productimgwidth); ?> " height="<?php echo esc_attr($productimgheight); ?> " src="<?php echo esc_url($image_product); ?> " class="attachment-shop_catalog wp-post-image" alt="<?php the_title(); ?> "> <?php echo '</div>'; } else { echo '<div class="kad-woo-image-size">'; echo woocommerce_template_loop_product_thumbnail(); echo '</div>'; } } }
protected function content($atts, $content = null) { $class_col = null; extract(shortcode_atts(array('num_cols' => '1', 'num_posts' => '12', 'products_type' => '1', 'products_slider' => '', 'slugs' => 'web-design,logo-design,illustration', 'slides_show' => '1', 'slides_scroll' => '1'), $atts)); // $width_class = ''; // $css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $width_class, $this->settings['base'], $atts ); switch ($num_cols) { case '2': $class_col = 'two_col'; break; case '3': $class_col = 'three_col'; break; case '4': $class_col = 'four_col'; break; default: $class_col = 'four_col'; break; } $args = array('post_type' => 'product', 'posts_per_page' => $num_posts); if ($products_type == '2') { $args = array('post_type' => 'product', 'posts_per_page' => $num_posts, 'meta_query' => array('relation' => 'OR', array('key' => '_sale_price', 'value' => 0, 'compare' => '>', 'type' => 'numeric'), array('key' => '_min_variation_sale_price', 'value' => 0, 'compare' => '>', 'type' => 'numeric'))); } if ($products_type == '3') { $args = array('post_type' => 'product', 'meta_key' => '_featured', 'meta_value' => 'yes', 'posts_per_page' => $num_posts); } if ($products_type == '4') { $cat_slugs = explode(',', $slugs); $args = array('posts_per_page' => $num_posts, 'tax_query' => array('relation' => 'AND', array('taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => $cat_slugs)), 'post_type' => 'product'); } ob_start(); ?> <?php if ($products_slider == 'true') { ?> <div class="slick_slider circled_custom_products" data-slick='{"slidesToShow": <?php echo esc_attr($slides_show); ?> , "slidesToScroll": <?php echo esc_attr($slides_scroll); ?> , "autoplay": true, "autoplaySpeed": 3000, "responsive": [{ "breakpoint": 1200, "settings": { "slidesToShow": 3, "slidesToScroll" : 1, "arrows" : false }}, { "breakpoint": 640, "settings": { "slidesToShow": 1, "arrows" : false, "slidesToScroll" : 1, "arrows" : false }}]}'> <?php } else { ?> <div class="circled_custom_products"> <?php } ?> <?php $products_loop = new WP_Query($args); if ($products_loop->have_posts()) { while ($products_loop->have_posts()) { $products_loop->the_post(); global $product, $post; ?> <div class="<?php echo $products_slider != 'true' ? esc_attr($class_col) : ''; ?> "> <div class="product_img_holder"> <?php $price = null; if ($product->is_on_sale() && $product->product_type == 'variable') { ?> <span class="bubble"> <?php $available_variations = $product->get_available_variations(); $maximumper = 0; for ($i = 0; $i < count($available_variations); ++$i) { $variation_id = $available_variations[$i]['variation_id']; $variable_product1 = new WC_Product_Variation($variation_id); $regular_price = $variable_product1->regular_price; $sales_price = $variable_product1->sale_price; $percentage = round(($regular_price - $sales_price) / $regular_price * 100, 1); if ($percentage > $maximumper) { $maximumper = $percentage; } } echo esc_html($price) . sprintf(__('%s', THEME_NAME), $maximumper . '%'); ?> </span><!-- end callout --> <?php } elseif ($product->is_on_sale() && $product->product_type == 'simple') { ?> <span class="bubble"> <?php $percentage = round(($product->regular_price - $product->sale_price) / $product->regular_price * 100); echo esc_html($price) . sprintf(__('%s', THEME_NAME), $percentage . '%'); ?> </span><!-- end bubble --> <?php } ?> <a href="<?php the_permalink(); ?> "> <span class="circled_icon_holder"><i class="icon icon-cross"></i></span> <?php woocommerce_template_loop_product_thumbnail(); ?> </a> </div> <div class="product_pricing_holder"> <h3><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h3> <?php woocommerce_template_loop_price(); ?> </div> </div> <?php } } ?> </div> <?php $output = ob_get_contents(); ob_end_clean(); return $output; }
$woocommerce_loop['loop']++; // Extra post classes $classes = array('product-item', 'product-list-item-wrap'); ?> <div <?php post_class($classes); ?> > <?php wc_get_template('loop/sale-flash.php'); ?> <div class="row product-list-view"> <div class="no-margin col-xs-12 col-sm-4 image-holder"> <?php woocommerce_template_loop_product_thumbnail('list-view'); ?> </div><!-- /.image-holder --> <div class="no-margin col-xs-12 col-sm-5 body-holder"> <div class="body"> <!--<div class="label-discount clear"></div>--> <div class="title"> <div class="pull-right"> <div class="star-holder clearfix"> <?php wc_get_template('loop/rating.php'); ?> </div> </div> <h4 class="product-title"><a href="<?php