function x_woocommerce_shop_thumbnail() { global $product; $id = get_the_ID(); $thumb = 'entry'; $rating = $product->get_rating_html(); woocommerce_show_product_sale_flash(); echo '<div class="entry-featured">'; echo '<a href="' . get_the_permalink() . '">'; echo get_the_post_thumbnail($id, $thumb); if (!empty($rating)) { echo '<div class="star-rating-container aggregate">' . $rating . '</div>'; } echo '</a>'; echo "</div>"; }
$loop->the_post(); global $product; ?> <li class="product"> <a href="<?php echo get_permalink($loop->post->ID); ?> " title="<?php echo esc_attr($loop->post->post_title ? $loop->post->post_title : $loop->post->ID); ?> "> <?php woocommerce_show_product_sale_flash($post, $product); ?> <?php if (has_post_thumbnail($loop->post->ID)) { echo get_the_post_thumbnail($loop->post->ID, 'shop_catalog'); } else { echo '<img src="' . woocommerce_placeholder_img_src() . '" alt="Placeholder" width="300px" height="300px" />'; } ?> <h3><?php the_title(); ?> </h3>
$zoom_class = ''; } ?> <div class="nm-product-thumbnails-col col-xs-1"> <?php do_action('woocommerce_product_thumbnails'); ?> </div> <div id="nm-product-images-col" class="nm-product-images-col <?php echo esc_attr($image_column_class); ?> "> <div class="images"> <?php woocommerce_show_product_sale_flash(); ?> <div id="nm-product-images-slider" class="slick-slider slick-arrows-small"> <?php // Featured image if (has_post_thumbnail()) { $image_title = esc_attr(get_the_title($post->ID)); $image = get_the_post_thumbnail($post->ID, apply_filters('single_product_large_thumbnail_size', 'shop_single'), array('alt' => $image_title)); if ($modal_enabled || $zoom_enabled) { $full_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); $image_icon = $has_featured_video ? 'nm-font-media-play' : 'nm-font-plus'; $image_wrap_open = sprintf('<a href="%s" class="nm-product-image-link zoom" data-size="%sx%s" itemprop="image">', esc_url($full_image[0]), intval($full_image[1]), intval($full_image[2])); $image_wrap_close = '<i class="nm-product-image-icon nm-font ' . $image_icon . '"></i></a>'; } else { $image_wrap_open = '';
function mango_woo_product($atts) { global $mango_settings; extract(shortcode_atts(array('product_style' => 'style2', 'textalign' => '', 'show_product' => '-1', 'product_cats' => '', 'post_per_column_style1' => ' fullwidth', 'per_column_desktop' => '3', 'selecttype' => '', 'per_column_tab' => '6', 'show_cat' => 'yes', 'show_rating' => 'yes', 'show_price' => 'yes'), $atts)); ob_start(); if ($product_style == 'style1') { ?> <div class="product-container<?php echo esc_attr($post_per_column_style1s); ?> "> <?php } elseif ($product_style == 'style2') { ?> <div class="row"> <?php } $args = array('post_type' => 'product', 'showposts' => $show_product, 'product_cat' => $product_cats); if ($selecttype == 'featured') { $args['meta_key'] = '_featured'; $args['meta_value'] = 'yes'; } else { if ($selecttype == 'selling') { $args['post__in'] = mango_woocomerce_bestsellers(); } } $argsd = query_posts($args); $post = new WP_Query($argsd); ?> <div class="owl-carousel home-newarrivals-carousel" data-items="<?php echo esc_attr($per_column_desktop); ?> " data-number-of-pro-cols="<?php if ($product_style == 'style2') { echo esc_attr($per_column_desktop); } elseif ($product_style == 'style1') { echo esc_attr($post_per_column_style1); } ?> "> <?php if (have_posts()) { while (have_posts()) { the_post(); global $product, $woocommerce; $product_cats = $product->get_categories(' | ', '', ''); $attachment_ids = $product->get_gallery_attachment_ids(); if ($product_style == 'style1') { ?> <div class="product"> <div class="product-top no-margin"> <figure> <a href="<?php echo get_the_permalink(); ?> " title="<?php echo get_the_title(); ?> "> <?php echo '<a href="' . get_the_permalink() . '" title="' . get_the_title() . '">' . get_the_post_thumbnail($post->ID, 'product-thumbnail', array("class" => "product-image")) . '</a>'; ?> </a> </figure> </div><!-- End .product-top --> <div class="product-meta-box"> <?php if ($show_cat == 'yes') { ?> <div class="product-cats"><?php echo $product_cats; ?> </div><!-- End .product-cats --> <?php } ?> <h3 class="product-title"><a href="<?php echo get_the_permalink(); ?> " title="<?php echo get_the_title(); ?> "><?php echo get_the_title(); ?> </a></h3> <?php if ($show_rating == 'yes') { ?> <?php if ($rating_html = $product->get_rating_html()) { $rating = $product->get_average_rating(); $rating_html = $product->get_rating_html(); $count = 0; ?> <div class="product-ratings"> <?php for ($i = 0; $i < (int) $rating; $i++) { $count++; echo '<span class="star active"></span>'; } if ($rating - (int) $rating >= 0.5) { $count++; echo '<span class="star active-half"></span>'; } for ($i = $count; $i < 5; $i++) { $count++; echo '<span class="star"></span>'; } ?> <span class="rating-amount"> <?php $rev_count = $product->get_review_count(); echo $rev_count . " "; if ($rev_count == 0 || $rev_count > 1) { _e("Reviews", 'mango'); } elseif ($rev_count == 1) { _e("Review", 'mango'); } ?> </span> </div> <?php } ?> <?php } ?> <?php if ($show_price == 'yes') { ?> <?php wc_get_template_part("loop/price"); ?> <?php } ?> </div><!-- End .product-meta-box --> </div><!-- End .product --> <?php } elseif ($product_style == 'style2') { ?> <div class="product <?php echo esc_attr($textalign); ?> "> <?php global $mango_settings; ?> <div class="product-top"> <?php if ($mango_settings['mango_show_compare_button']) { if (in_array('yith-woocommerce-compare/init.php', apply_filters('active_plugins', get_option('active_plugins')))) { echo do_shortcode('[yith_compare_button]'); } } if ($mango_settings['mango_show_quick_button']) { ?> <div class="woocommerce product quick-button"> <a class="top-line-a right open-product btn btn-custom2 btn-xs" data-id="<?php echo the_ID(); ?> "><i class="fa fa-expand"></i> <span><?php _e('Quick View', 'mango'); ?> </span> </a> </div> <?php } if ($mango_settings['mango_show_wishlist_button']) { if (in_array('yith-woocommerce-wishlist/init.php', apply_filters('active_plugins', get_option('active_plugins')))) { echo do_shortcode('[yith_wcwl_add_to_wishlist]'); } } ?> <div class="img-effect"> <?php echo '<a href="' . get_the_permalink() . '" title="' . get_the_title() . '">' . get_the_post_thumbnail($post->ID, 'product-thumbnail', array("class" => "product-image")) . '</a>'; if ($attachment_ids) { foreach ($attachment_ids as $attachment_id) { $image_link = wp_get_attachment_url($attachment_id); echo '<a class="hover-img" href="' . get_the_permalink() . '" title="' . get_the_title() . '">' . wp_get_attachment_image($attachment_id, 'product-image') . '</a>'; } } ?> </div> <div class="product-action-container"> <?php if ($mango_settings['mango_show_add_to_cart_button']) { echo apply_filters('woocommerce_loop_add_to_cart_link', sprintf('<a href="%s" rel="nofollow" data-product_id="%s" data-product_sku="%s" data-quantity="%s" class="product-btn product-add-btn %s product_type_%s"><i class="fa fa-shopping-cart"></i>%s</a>', esc_url($product->add_to_cart_url()), esc_attr($product->id), esc_attr($product->get_sku()), esc_attr(isset($quantity) ? $quantity : 1), $product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : '', esc_attr($product->product_type), esc_html($product->add_to_cart_text())), $product); } ?> </div><!-- end .product-action-container --> </div><!-- End .product-top --> <?php if ($show_cat == 'yes') { ?> <div class="product-cats"><?php echo $product_cats; ?> </div><!-- End .product-cats --> <?php } ?> <h3 class="product-title"><a href="<?php echo get_the_permalink(); ?> " title="<?php get_the_title(); ?> "><?php echo get_the_title(); ?> </a></h3> <?php if ($show_rating == 'yes') { ?> <?php if ($rating_html = $product->get_rating_html()) { $rating = $product->get_average_rating(); $rating_html = $product->get_rating_html(); $count = 0; ?> <div class="product-ratings"> <?php for ($i = 0; $i < (int) $rating; $i++) { $count++; echo '<span class="star active"></span>'; } if ($rating - (int) $rating >= 0.5) { $count++; echo '<span class="star active-half"></span>'; } for ($i = $count; $i < 5; $i++) { $count++; echo '<span class="star"></span>'; } ?> <span class="rating-amount"> <?php $rev_count = $product->get_review_count(); echo $rev_count . " "; if ($rev_count == 0 || $rev_count > 1) { _e("Reviews", 'mango'); } elseif ($rev_count == 1) { _e("Review", 'mango'); } ?> </span> </div> <?php } ?> <?php } ?> <?php if ($show_price == 'yes') { ?> <?php wc_get_template_part("loop/price"); ?> <?php } ?> </div><!-- End .product --> <?php } } } ?> </div><!-- End .col-md-3 --> <!--******************** QUICK VIEW START ******************************--> <?php if (have_posts()) { while (have_posts()) { the_post(); global $product, $woocommerce; $product_cats = $product->get_categories(' | ', '', ''); $attachment_ids = $product->get_gallery_attachment_ids(); ?> <div id="product-popup_<?php echo the_ID(); ?> " class="overlay-popup mypopup mfp-hide"> <div itemscope itemtype="<?php echo woocommerce_get_product_schema(); ?> " id="product-<?php the_ID(); ?> " <?php post_class("row"); ?> > <?php //do_action( 'woocommerce_before_single_product_summary' ); ?> <div class="col-md-6 col-sm-6"> <div class="images product-gallery-container"> <div class="product-top "> <?php woocommerce_show_product_sale_flash(); if (has_post_thumbnail()) { $image_title = esc_attr(get_the_title(get_post_thumbnail_id())); $image_caption = get_post(get_post_thumbnail_id())->post_excerpt; $image_link = wp_get_attachment_url(get_post_thumbnail_id()); $image = get_the_post_thumbnail($post->ID, apply_filters('single_product_large_thumbnail_size', 'shop_single'), array('title' => $image_title, 'alt' => $image_title)); $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); //single-product // $image = $image['0']; $zoom_img = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); $zoom_img = $zoom_img['0']; echo apply_filters("woocommerce_single_product_image_html", sprintf('<img class="product-zoom" src="%s" data-zoom-image="%s" alt="%s"/>', $zoom_img, $zoom_img, $image_title), $post->ID); } else { echo apply_filters('woocommerce_single_product_image_html', sprintf('<img class="product-zoom" src="%s" data-zoom-image="%s" alt="%s" />', wc_placeholder_img_src(), wc_placeholder_img_src(), __('Placeholder', 'woocommerce')), $post->ID); } ?> </div> <?php // do_action( 'woocommerce_product_thumbnails' ); $attachment_ids = $product->get_gallery_attachment_ids(); if (has_post_thumbnail()) { if (empty($attachment_ids)) { $attachment_ids[] = get_post_thumbnail_id($post->ID); } else { array_unshift($attachment_ids, get_post_thumbnail_id($post->ID)); } } if ($attachment_ids) { $loop = 0; $columns = apply_filters('woocommerce_product_thumbnails_columns', 3); ?> <div class="product-gallery-wrapper thumbnails <?php echo 'columns-' . $columns; ?> "> <div class="product-quick"> <?php foreach ($attachment_ids as $attachment_id) { $image = wp_get_attachment_image_src($attachment_id, apply_filters('single_product_small_thumbnail_size', 'shop_single')); $image_zoom = wp_get_attachment_image_src($attachment_id, apply_filters('single_product_small_thumbnail_size', 'full')); $image_class = 'product-gallery-item'; $image_title = esc_attr(get_the_title($attachment_id)); ?> <div class="gallery_images"> <a href="#" data-image="<?php echo $image[0]; ?> " data-zoom-image="<?php echo $image_zoom[0]; ?> " class="<?php echo $image_class; ?> " title="<?php echo $image_title; ?> "><img src="<?php echo $image[0]; ?> " alt="<?php echo $image_title; ?> "/></a> </div> <?php } ?> <div class="clearfix"></div> </div> </div> <?php } ?> </div> </div> <div class="col-md-6 col-sm-6"> <div class="summary entry-summary"> <div class="product-details text-left"> <?php do_action('woocommerce_single_product_summary'); ?> </div> </div> <!-- .summary --> <?php do_action('woocommerce_after_single_product_summary'); ?> <meta itemprop="url" content="<?php the_permalink(); ?> " /> </div> <!--col-md-6--> </div> <!-- #product-<?php the_ID(); ?> --> <?php do_action('woocommerce_after_single_product'); ?> </div><?php } } ?> <script type="text/javascript"> jQuery( document ).ready(function() { /* swap images for zoom on click event */ jQuery('.product-quick').find('a').on('click', function (e) { var ez = jQuery('.product-zoom').data('elevateZoom'), smallImg = jQuery(this).data('image'), bigImg = jQuery(this).data('zoom-image'); ez.swaptheimage(smallImg, bigImg); e.preventDefault(); }) }) </script> <!-- ************************ QUICK VIEW END ******************* --> </div> <?php wp_reset_query(); $output = ob_get_clean(); return $output; }
function pmc_productBlock($title, $number_post, $rowsB, $categories, $port_text, $type, $product_ajax) { wp_enqueue_script('pmc_bxSlider'); $rand = rand(0, 99); global $pmc_data, $sitepress, $wpdb; if (isset($number_post)) { $showpost = $number_post; } else { $showpost = 8; } if (isset($rowsB)) { $rows = $rowsB; } else { $rows = 4; } if (isset($productShow)) { $rows = $productShow; } if ($type == 'recent') { $args = array('post_type' => 'product', 'posts_per_page' => $showpost, 'tax_query' => array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => $categories))); $pc = new WP_Query($args); } if ($type == 'feautured') { $args = array('post_type' => 'product', 'orderby' => 'rand', 'posts_per_page' => $showpost, 'meta_query' => array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN'), array('key' => '_featured', 'value' => 'yes')), 'tax_query' => array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => $categories))); $pc = new WP_Query($args); } ?> <script type="text/javascript"> jQuery(document).ready(function(){ // Slider var $slider = jQuery('#productR-<?php echo $rand; ?> ').bxSlider({ controls: true, displaySlideQty: 1, default: 1000, easing : 'easeInOutQuint', prevText : '', nextText : '', pager :false }); }); </script> <div class="homerecent <?php echo $type; ?> "> <div class="wocategoryFull"> <div class="productR <?php echo $type; ?> "> <div class="homerecentInner"> <div id = "showpost-<?php echo $type; ?> -<?php echo $rand; ?> "> <div class="showpostload"><div class="loading"></div></div> <div class = "closehomeshow-<?php echo $type; ?> product closeajax"><i class="icon-remove"></i></div> <div class="showpostpostcontent"></div> </div> <div class="titlebordrtext"><h2 class="titleborderh2"><?php echo $title; ?> </h2></div> <div class="titleborderOut"><div class="titleborder"></div></div> <div class="homerecent productRH" > <ul id="productR-<?php echo $rand; ?> " class="productR"> <?php $average = 0; $currentindex = ''; if ($pc->have_posts()) { $countPost = 1; $countitem = 1; ?> <?php while ($pc->have_posts()) { $pc->the_post(); global $product; if ($countitem == 1) { echo '<li>'; } $postmeta = get_post_custom(get_the_id()); if ($countPost != 4) { echo '<div class="one_fourth" >'; } else { echo '<div class="one_fourth last" >'; $countPost = 0; } if (has_post_thumbnail()) { $image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'shop', false); $image = $image[0]; } else { $image = get_template_directory_uri() . '/images/placeholder-580.png'; } ?> <?php if ($product_ajax == 'true') { ?> <div class="click" id="<?php echo $type; ?> _<?php echo get_the_id(); ?> _<?php echo $rand; ?> "> <?php } ?> <?php if ($product_ajax != 'true') { ?> <a href="<?php echo get_permalink(get_the_id()); ?> "> <?php } ?> <?php if (isset($postmeta["video_active"][0]) && $postmeta["video_active"][0] == 1) { ?> <div class="recentimage"> <div class="image"> <div class="loading"></div> <?php if ($postmeta["selectv"][0] == 'vimeo') { echo '<iframe class = "productIframe full" src="http://player.vimeo.com/video/' . $postmeta["video_post_url"][0] . '" width="230" height="' . $pmc_data['catalog_img_height'] . '" ></iframe>'; } else { if ($postmeta["selectv"][0] == 'youtube') { echo '<iframe class = "productIframe full youtube" width="230" height="' . $pmc_data['catalog_img_height'] . '" src="http://www.youtube.com/embed/' . $postmeta["video_post_url"][0] . '" ></iframe>'; } else { //echo 'Please select a Video Site via the WordPress Admin'; } } ?> </div> </div> <?php } else { ?> <div class="recentimage"> <div class="image"> <div class="loading"></div> <?php if (has_post_thumbnail(get_the_ID())) { echo '<img src = ' . $image . ' alt = "' . get_the_title() . '" > '; } else { echo '<img src="' . woocommerce_placeholder_img_src() . '" alt="Placeholder" width="230px" height="' . $pmc_data['catalog_img_height'] . 'px" />'; } ?> </div> </div> <?php if ($product_ajax != 'true') { ?> </a> <?php } ?> <?php } ?> <div class="recentdescription"> <?php woocommerce_show_product_sale_flash($product); ?> <?php if ($product_ajax != 'true') { ?> <a href="<?php echo get_permalink(get_the_id()); ?> "> <?php } ?> <h3><?php the_title(); ?> </h3> <?php if ($product_ajax != 'true') { ?> </a> <?php } ?> </div> <?php if ($product_ajax == 'true') { ?> </div> <?php } ?> <div class="product-price-cart"> <div class="recentPrice"><span class="price"><?php echo $product->get_price_html(); ?> </span></div> <div class="recentCart"><?php woocommerce_template_loop_add_to_cart($product); ?> </div> </div> </div> <?php $countPost++; if ($countitem == $rows) { $countitem = 0; ?> </li> <?php } $countitem++; } } wp_reset_query(); ?> </ul> </div> </div> </div> </div> <?php }
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); $product_cat = $instance['product_cat']; $product_total = $instance['product_total']; if (!is_numeric($product_total)) { $product_total = 12; } global $uni_carousel_id; echo $args['before_widget'] . "\n"; if ($title) { echo $before_title . $title . $after_title . "\n"; } ?> <?php if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))) { ?> <div id="woo-product-items" class="products grid-view list-carousel responsive"> <ul id="<?php echo "foo" . $uni_carousel_id; ?> " class="products products-carousel"> <script type="text/javascript"> /*global jQuery:false */ jQuery(document).ready(function($) { "use strict"; // Products Carousel $('#foo<?php echo $uni_carousel_id; ?> ').carouFredSel({ responsive: true, auto: false, width: '100%', scroll: { items : 2, pauseOnHover : true }, prev: '#prev<?php echo $uni_carousel_id; ?> ', next: '#next<?php echo $uni_carousel_id; ?> ', pagination: "#pager<?php echo $uni_carousel_id; ?> ", items: { width: 250, height: 'auto', visible: { min: 2, max: 4 } } }); }); </script> <?php $args = array('post_type' => 'product', 'product_cat' => "{$product_cat}", 'posts_per_page' => $product_total); $loop = new WP_Query($args); $products_available = $loop->found_posts; while ($loop->have_posts()) { $loop->the_post(); global $product; global $woocommerce; $large_image_url = wp_get_attachment_image_src(get_post_thumbnail_id($loop->post->ID), apply_filters('single_product_large_thumbnail_size', 'shop_catalog')); $productlink = get_permalink($loop->post->ID); $content_excerpt = apply_filters('woocommerce_short_description', $loop->post->post_excerpt); ?> <li class="product-grid-container"> <div class="product-item"> <div class="title"> <h3 class="title-container product-titles"><a href="<?php echo $productlink; ?> "><?php the_title(); ?> </a></h3> </div> <div class="image mosaic-block bar"> <?php if ($content_excerpt != "") { ?> <a href="<?php echo $productlink; ?> " class="mosaic-overlay"> <div class="details"> <?php echo $content_excerpt; ?> </div> </a><?php } ?> <a href="<?php echo $productlink; ?> "> <span class="price heading-style"><?php echo $product->get_price_html(); ?> </span> <?php woocommerce_show_product_sale_flash($loop->post, $product); ?> <?php if (!$large_image_url == "") { ?> <img src="<?php echo $large_image_url[0]; ?> " alt="" /><?php } else { ?> <img src="<?php echo woocommerce_placeholder_img_src(); ?> " width="240" height="160" alt="" /><?php } ?> </a> </div> <div class="info"> <div class="float-left"> <?php woocommerce_template_loop_rating($loop->post, $product); ?> </div> <div class="float-right"> <?php woocommerce_template_loop_add_to_cart($loop->post, $product); ?> </div> </div> </div> </li> <?php } wp_reset_query(); ?> </ul> <div id="pager<?php echo $uni_carousel_id; $uni_carousel_id++; ?> " class="pager"></div> <div class="clear"></div> </div><?php } ?> </div> <?php }
public function widget($args, $instance) { $title = apply_filters('widget_title', $instance['title']); // before and after widget arguments are defined by themes echo $args['before_widget']; if (!empty($title)) { echo $args['before_title'] . $title . $args['after_title']; } // This is where you run the code and display the output $prod_cats = $this->get_product_categories(); if ($prod_cats == NULL) { return NULL; } $index = 0; ?> <div class="shop-sidebar-slider"> <div id="upw-carousel" class="carousel slide"> <!-- Controls --> <a class="pull-right right carousel-control" href="#upw-carousel" role="button" data-slide="next"> <i class="icon-right-open-big" aria-hidden="true"></i> <span class="sr-only"><?php _e('Next', 'sage'); ?> </span> </a> <a class="pull-right left carousel-control" href="#upw-carousel" role="button" data-slide="prev"> <i class="icon-left-open-big" aria-hidden="true"></i> <span class="sr-only"><?php _e('Previous', 'sage'); ?> </span> </a> <!-- Wrapper for slides --> <div class="carousel-inner" role="listbox"> <?php $args = array('post_type' => 'product', 'posts_per_page' => -1, 'tax_query' => array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => $prod_cats)), 'orderby' => 'rand'); $loop = new WP_Query($args); while ($loop->have_posts()) { $loop->the_post(); $index++; global $product; global $post; //need debug on sale product ?> <article <?php post_class('item ' . ($index == 1 ? 'active' : '')); ?> > <header> <?php woocommerce_show_product_sale_flash($post, $product); ?> <figure class="entry-image"> <?php if (has_post_thumbnail($loop->post->ID)) { echo get_the_post_thumbnail($loop->post->ID, 'shop_catalog'); } else { echo '<img src="' . woocommerce_placeholder_img_src() . '" alt="Placeholder" width="300px" height="300px" />'; } ?> </figure> <div class="entry-cat"> <?php $product_cats = wp_get_post_terms(get_the_ID(), 'product_cat'); if ($product_cats && !is_wp_error($product_cats)) { $single_cat = array_shift($product_cats); echo $single_cat->name; } ?> </div> <div class="entry-title"><?php the_title(); ?> </div> <a class="entry-link" href="<?php echo get_permalink($loop->post->ID); ?> " title="<?php echo esc_attr($loop->post->post_title ? $loop->post->post_title : $loop->post->ID); ?> "> <?php _e('View Now', 'sage'); ?> ► </a> </header> </article> <?php } ?> <?php wp_reset_query(); ?> </div> </div> </div> <?php echo $args['after_widget']; }