function thb_product_single($atts, $content = null) { extract(shortcode_atts(array('product_id' => ''), $atts)); global $post, $product, $woocommerce, $woocommerce_loop; $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'p' => $product_id); $products = new WP_Query($args); ob_start(); $catalog_mode = ot_get_option('shop_catalog_mode', 'off'); $shop_product_listing = ot_get_option('shop_product_listing', 'style1'); if ($products->have_posts()) { while ($products->have_posts()) { $products->the_post(); ?> <?php $product = get_product($products->post->ID); ?> <div class="products"> <article itemscope itemtype="<?php echo woocommerce_get_product_schema(); ?> " <?php post_class("post small-12 columns " . $shop_product_listing); ?> > <?php do_action('woocommerce_before_shop_loop_item'); ?> <?php $image_html = ""; if (has_post_thumbnail()) { $image_html = wp_get_attachment_image(get_post_thumbnail_id(), 'shop_catalog'); } ?> <?php if ($shop_product_listing == 'style1') { ?> <figure class="fresco"> <?php do_action('thb_product_badge'); ?> <?php echo $image_html; ?> <div class="overlay"></div> <div class="buttons"> <?php echo thb_wishlist_button(); ?> <div class="post-title<?php if ($catalog_mode == 'on') { echo ' catalog-mode'; } ?> "> <a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a> </div> <?php if ($catalog_mode != 'on') { ?> <?php /** * woocommerce_after_shop_loop_item_title hook * * @hooked woocommerce_template_loop_price - 10 */ do_action('woocommerce_after_shop_loop_item_title'); ?> <?php do_action('woocommerce_after_shop_loop_item'); ?> <?php } ?> </div> </figure> <?php } else { if ($shop_product_listing == 'style2') { ?> <figure class="fresco"> <?php do_action('thb_product_badge'); ?> <a href="<?php the_permalink(); ?> "><?php echo $image_html; ?> </a> </figure> <div class="post-title<?php if ($catalog_mode == 'on') { echo ' catalog-mode'; } ?> "> <a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a> </div> <?php if ($catalog_mode != 'on') { ?> <?php /** * woocommerce_after_shop_loop_item_title hook * * @hooked woocommerce_template_loop_price - 10 */ do_action('woocommerce_after_shop_loop_item_title'); ?> <?php do_action('woocommerce_after_shop_loop_item'); ?> <?php } ?> <?php } } ?> </article><!-- end product --> </div> <?php } } $out = ob_get_contents(); if (ob_get_contents()) { ob_end_clean(); } wp_reset_query(); wp_reset_postdata(); remove_filter('posts_clauses', array($woocommerce->query, 'order_by_rating_post_clauses')); return $out; }
/* @version 3.0.0 */ if (!defined('ABSPATH')) { exit; } global $product; if (ThemexUser::isMember($post->post_author)) { do_action('woocommerce_before_single_product'); if (post_password_required()) { echo get_the_password_form(); return; } ?> <div itemscope itemtype="<?php echo woocommerce_get_product_schema(); ?> " id="product-<?php the_ID(); ?> " <?php post_class(); ?> > <aside class="column fourcol"> <?php do_action('woocommerce_before_single_product_summary'); $show = false; ob_start(); ?> <div class="widget sidebar-widget">
<?php /** * woocommerce_before_single_product hook * * @hooked wc_print_notices - 10 */ do_action( 'woocommerce_before_single_product' ); if ( post_password_required() ) { echo get_the_password_form(); return; } ?> <div itemscope itemtype="<?php echo woocommerce_get_product_schema(); ?>" id="product-<?php the_ID(); ?>" <?php post_class(); ?>> <div class="row product-detail-inner"> <div class="col-sm-5"> <?php /** * woocommerce_before_single_product_summary hook * * @hooked woocommerce_show_product_sale_flash - 10 * @hooked woocommerce_show_product_images - 20 */ do_action( 'woocommerce_before_single_product_summary' ); ?> </div> <div class="col-sm-7"> <div class="summary entry-summary">
function thb_product($atts, $content = null) { extract(shortcode_atts(array('product_sort' => 'best-sellers', 'carousel' => 'no', 'item_count' => '4', 'columns' => '4', 'cat' => '', 'product_ids' => ''), $atts)); global $post, $product, $woocommerce, $woocommerce_loop; $args = array(); if ($product_sort == "latest-products") { $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $item_count); } else { if ($product_sort == "featured-products") { $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'meta_key' => '_featured', 'meta_value' => 'yes', 'posts_per_page' => $item_count); } else { if ($product_sort == "top-rated") { add_filter('posts_clauses', array($woocommerce->query, 'order_by_rating_post_clauses')); $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $item_count); $args['meta_query'] = $woocommerce->query->get_meta_query(); } else { if ($product_sort == "sale-products") { $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $item_count, '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'))); } else { if ($product_sort == "by-category") { $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'product_cat' => $cat, 'posts_per_page' => $item_count); } else { if ($product_sort == "by-id") { $product_id_array = explode(',', $product_ids); $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'post__in' => $product_id_array); } else { $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $item_count, 'meta_key' => 'total_sales', 'orderby' => 'meta_value'); } } } } } } $products = new WP_Query($args); $woocommerce_loop['columns'] = apply_filters('loop_shop_columns', $columns); ob_start(); switch ($columns) { case 2: $col = 'medium-6'; break; case 3: $col = 'medium-4'; break; case 4: $col = 'medium-3'; break; } $catalog_mode = ot_get_option('shop_catalog_mode', 'off'); if ($products->have_posts()) { ?> <?php if ($carousel == "yes") { ?> <div class="carousel-container"> <div class="carousel products owl row" data-columns="<?php echo $columns; ?> " data-navigation="true"> <?php while ($products->have_posts()) { $products->the_post(); ?> <?php $product = wc_get_product($products->post->ID); ?> <article itemscope itemtype="<?php echo woocommerce_get_product_schema(); ?> " <?php post_class("post small-6 {$col} columns"); ?> > <?php do_action('woocommerce_before_shop_loop_item'); ?> <figure class="fresco"> <?php $image_html = ""; if (thb_out_of_stock()) { echo '<span class="badge out-of-stock">' . __('Out of Stock', THB_THEME_NAME) . '</span>'; } else { if ($product->is_on_sale()) { echo apply_filters('woocommerce_sale_flash', '<span class="badge onsale">' . __('Sale', THB_THEME_NAME) . '</span>', $post, $product); } } if (has_post_thumbnail()) { $image_html = wp_get_attachment_image(get_post_thumbnail_id(), 'shop_catalog'); } ?> <?php echo $image_html; ?> <div class="overlay"> <div class="buttons"> <?php echo thb_wishlist_button(); ?> <a class="quick quick-view" data-id="<?php echo $post->ID; ?> " href="#"><i class="icon-budicon-545"></i></a> </div> </div> </figure> <div class="post-title<?php if ($catalog_mode == 'on') { echo ' catalog-mode'; } ?> "> <a href="<?php the_permalink(); ?> "><?php echo thb_ShortenText(get_the_title($post->ID), 20); ?> </a> <?php if ($catalog_mode != 'on') { ?> <?php /** * woocommerce_after_shop_loop_item_title hook * * @hooked woocommerce_template_loop_price - 10 */ do_action('woocommerce_after_shop_loop_item_title'); ?> <?php do_action('woocommerce_after_shop_loop_item'); ?> <?php } ?> </div> </article><!-- end product --> <?php } // end of the loop. ?> </div> </div> <?php } else { ?> <div class="products row" data-equal="article"> <?php while ($products->have_posts()) { $products->the_post(); ?> <?php $product = wc_get_product($products->post->ID); ?> <article itemscope itemtype="<?php echo woocommerce_get_product_schema(); ?> " <?php post_class("post small-6 {$col} columns"); ?> > <?php do_action('woocommerce_before_shop_loop_item'); ?> <figure class="fresco"> <?php $image_html = ""; if (thb_out_of_stock()) { echo '<span class="badge out-of-stock">' . __('Out of Stock', THB_THEME_NAME) . '</span>'; } else { if ($product->is_on_sale()) { echo apply_filters('woocommerce_sale_flash', '<span class="badge onsale">' . __('Sale', THB_THEME_NAME) . '</span>', $post, $product); } } if (has_post_thumbnail()) { $image_html = wp_get_attachment_image(get_post_thumbnail_id(), 'shop_catalog'); } ?> <?php echo $image_html; ?> <div class="overlay"> <div class="buttons"> <?php echo thb_wishlist_button(); ?> <a class="quick quick-view" data-id="<?php echo $post->ID; ?> " href="#"><i class="icon-budicon-545"></i></a> </div> </div> </figure> <div class="post-title<?php if ($catalog_mode == 'on') { echo ' catalog-mode'; } ?> "> <a href="<?php the_permalink(); ?> "><?php echo thb_ShortenText(get_the_title($post->ID), 25); ?> </a> <?php if ($catalog_mode != 'on') { ?> <?php /** * woocommerce_after_shop_loop_item_title hook * * @hooked woocommerce_template_loop_price - 10 */ do_action('woocommerce_after_shop_loop_item_title'); ?> <?php do_action('woocommerce_after_shop_loop_item'); ?> <?php } ?> </div> </article><!-- end product --> <?php } // end of the loop. ?> </div> <?php } ?> <?php } $out = ob_get_contents(); if (ob_get_contents()) { ob_end_clean(); } wp_reset_query(); wp_reset_postdata(); remove_filter('posts_clauses', array($woocommerce->query, 'order_by_rating_post_clauses')); return $out; }
function load_products() { $type = isset($_POST['type']) ? $_POST['type'] : "latest-products"; $footer_products_count = ot_get_option('footer_products_count', 6); if ($type == "latest-products") { $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $footer_products_count, 'no_found_rows' => true, 'suppress_filters' => 0); } else { if ($type == "featured-products") { $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $footer_products_count, 'meta_query' => array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN'), array('key' => '_featured', 'value' => 'yes')), 'no_found_rows' => true, 'suppress_filters' => 0); } else { if ($type == "best-sellers") { $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $footer_products_count, 'meta_key' => 'total_sales', 'orderby' => 'meta_value', 'meta_query' => array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN')), 'no_found_rows' => true, 'suppress_filters' => 0); } else { $category = get_term_by('id', $type, 'product_cat'); $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'product_cat' => $category->slug, 'posts_per_page' => $footer_products_count, 'no_found_rows' => true, 'suppress_filters' => 0); } } } $products = new WP_Query($args); $catalog_mode = ot_get_option('shop_catalog_mode', 'off'); $shop_product_listing = ot_get_option('shop_product_listing', 'style1'); global $post; if ($products->have_posts()) { ?> <div class="carousel products no-padding owl row" data-columns="6" data-navigation="true" data-loop="true" data-bgcheck="false"> <?php while ($products->have_posts()) { $products->the_post(); ?> <?php $product = get_product($products->post->ID); ?> <article itemscope itemtype="<?php echo woocommerce_get_product_schema(); ?> " <?php post_class("post small-6 medium-4 large-2 columns product " . $shop_product_listing); ?> > <?php do_action('woocommerce_before_shop_loop_item'); ?> <?php $image_html = ""; if (has_post_thumbnail()) { $image_html = wp_get_attachment_image(get_post_thumbnail_id(), 'shop_catalog'); } ?> <?php if ($shop_product_listing == 'style1') { ?> <figure class="fresco"> <?php do_action('thb_product_badge'); ?> <?php echo $image_html; ?> <div class="overlay"></div> <div class="buttons"> <?php echo thb_wishlist_button(); ?> <div class="post-title<?php if ($catalog_mode == 'on') { echo ' catalog-mode'; } ?> "> <a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a> </div> <?php if ($catalog_mode != 'on') { ?> <?php /** * woocommerce_after_shop_loop_item_title hook * * @hooked woocommerce_template_loop_price - 10 */ do_action('woocommerce_after_shop_loop_item_title'); ?> <?php do_action('woocommerce_after_shop_loop_item'); ?> <?php } ?> </div> </figure> <?php } else { if ($shop_product_listing == 'style2') { ?> <figure class="fresco"> <?php do_action('thb_product_badge'); ?> <a href="<?php the_permalink(); ?> "><?php echo $image_html; ?> </a> </figure> <div class="post-title<?php if ($catalog_mode == 'on') { echo ' catalog-mode'; } ?> "> <a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a> </div> <?php if ($catalog_mode != 'on') { ?> <?php /** * woocommerce_after_shop_loop_item_title hook * * @hooked woocommerce_template_loop_price - 10 */ do_action('woocommerce_after_shop_loop_item_title'); ?> <?php do_action('woocommerce_after_shop_loop_item'); ?> <?php } ?> <?php } } ?> </article> <?php } ?> </div> <div class="ai-dotted ai-indicator"><span class="ai-inner1"></span><span class="ai-inner2"></span><span class="ai-inner3"></span></div> <?php } wp_reset_query(); wp_reset_postdata(); die; }
*/ if (!defined('ABSPATH')) { exit; } // Exit if accessed directly /** * woocommerce_before_single_product hook * * @hooked wc_print_notices - 10 */ do_action('woocommerce_before_single_product'); if (post_password_required()) { echo get_the_password_form(); return; } echo beans_open_markup('woo_product_single_wrap', 'div', array('itemscope' => '', 'itemtype' => woocommerce_get_product_schema(), 'id' => 'product-' . get_the_ID(), 'class' => implode(' ', post_class()))); #TODO Double check /** * woocommerce_before_single_product_summary hook * * @hooked woocommerce_show_product_sale_flash - 10 * @hooked woocommerce_show_product_images - 20 */ do_action('woocommerce_before_single_product_summary'); echo beans_open_markup('woo_product_single_summary', 'div', array('class' => 'summary entry-summary')); /** * woocommerce_single_product_summary hook * * @hooked woocommerce_template_single_title - 5 * @hooked woocommerce_template_single_rating - 10 * @hooked woocommerce_template_single_price - 10
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; }
/** * woocommerce_before_single_product hook * * @hooked wc_print_notices - 10 */ //do_action( 'woocommerce_before_single_product' ); if ( post_password_required() ) { echo get_the_password_form(); return; } ?> <!-- Add class --> <div itemscope itemtype="<?php echo woocommerce_get_product_schema(); ?>" id="product-<?php the_ID(); ?>" <?php $classes[] = "col-xs-12 col-sm-9 content-woocommerce" ; post_class( $classes ); ?>> <!-- Título del producto --> <?php $title_product = get_the_title(); ?> <h1 class="page-title title-ventas title-product hidden-xs"> <span> <?= $title_product; ?> </span> </h1> <?php /** * woocommerce_before_single_product_summary hook * * @hooked woocommerce_show_product_sale_flash - 10
function thb_grid($atts, $content = null) { extract(shortcode_atts(array('type' => 'categories', 'style' => 'style1', 'cat' => '', 'product_ids' => '', 'animation' => 'animation fade-in'), $atts)); global $woocommerce, $woocommerce_loop, $product, $post; $args = $product_categories = $category_ids = array(); $cats = explode(",", $cat); foreach ($cats as $cat) { $c = get_term_by('slug', $cat, 'product_cat'); if ($c) { array_push($category_ids, $c->term_id); } } $args = array('orderby' => 'name', 'order' => 'ASC', 'hide_empty' => '0', 'include' => $category_ids); $product_categories = get_terms('product_cat', $args); ob_start(); $i = 1; ?> <?php if ($type == "categories") { ?> <?php if ($product_categories) { ?> <div class="grid"> <?php foreach ($product_categories as $category) { if ($style == "style1") { switch ($i) { case 1: case 6: case 11: case 16: $imagesize = array("1440", "800"); $articlesize = 'small-12 medium-8'; break; case 2: case 7: case 12: case 17: $imagesize = array("720", "406"); $articlesize = 'small-12 medium-4 grid-sizer'; break; case 4: case 5: case 9: case 10: case 14: case 15: $imagesize = array("720", "400"); $articlesize = 'small-12 medium-4'; break; case 3: case 8: case 13: case 18: $imagesize = array("720", "800"); $articlesize = 'small-12 medium-4'; break; } } else { if ($style == "style2") { switch ($i) { case 1: case 13: $imagesize = array("720", "798"); $articlesize = 'small-12 medium-6'; break; case 2: case 4: case 5: case 6: case 9: case 8: case 10: case 11: case 14: case 15: $imagesize = array("360", "400"); $articlesize = 'small-12 medium-3 grid-sizer'; break; case 3: case 7: case 12: $imagesize = array("360", "806"); $articlesize = 'small-12 medium-3'; break; } } } ?> <article class="product-category item <?php echo $articlesize; ?> columns <?php echo $animation; ?> "> <a href="<?php echo get_term_link($category->slug, 'product_cat'); ?> "> <?php $small_thumbnail_size = apply_filters('single_product_small_thumbnail_size', 'shop_catalog'); $thumbnail_id = get_woocommerce_term_meta($category->term_id, 'thumbnail_id', true); if ($thumbnail_id) { $image = wp_get_attachment_image_src($thumbnail_id, 'full'); $image_src = $image[0]; $image = aq_resize($image_src, $imagesize[0], $imagesize[1], true, true, true); } else { $image = wc_placeholder_img_src(); } if ($image_src) { echo '<img src="' . $image . '" alt="' . esc_attr($category->name) . '" width="' . $imagesize[0] . '" height="' . $imagesize[1] . '" />'; } ?> <div class="title"> <h2><?php echo $category->name; if ($category->count > 0) { echo apply_filters('woocommerce_subcategory_count_html', ' <span class="count">(' . $category->count . ')</span>', $category); } ?> </h2> </div> </a> </article> <?php $i++; } ?> </div> <?php } woocommerce_reset_loop(); ?> <?php } else { ?> <?php $product_id_array = explode(',', $product_ids); $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'post__in' => $product_id_array, 'posts_per_page' => "-1"); $products = new WP_Query($args); if ($products->have_posts()) { ?> <div class="grid products"> <?php while ($products->have_posts()) { $products->the_post(); if ($style == "style1") { switch ($i) { case 1: case 6: case 11: case 16: $imagesize = array("1440", "800"); $articlesize = 'small-12 medium-8'; break; case 2: case 7: case 12: case 17: $imagesize = array("720", "406"); $articlesize = 'small-12 medium-4 grid-sizer'; break; case 4: case 5: case 9: case 10: case 14: case 15: $imagesize = array("720", "400"); $articlesize = 'small-12 medium-4'; break; case 3: case 8: case 13: case 18: $imagesize = array("720", "800"); $articlesize = 'small-12 medium-4'; break; } } else { if ($style == "style2") { switch ($i) { case 1: case 13: $imagesize = array("720", "798"); $articlesize = 'small-12 medium-6'; break; case 2: case 4: case 5: case 6: case 9: case 8: case 10: case 11: case 14: case 15: $imagesize = array("360", "400"); $articlesize = 'small-12 medium-3 grid-sizer'; break; case 3: case 7: case 12: $imagesize = array("360", "806"); $articlesize = 'small-12 medium-3'; break; } } } global $product, $post; $catalog_mode = ot_get_option('shop_catalog_mode', 'off'); ?> <article itemscope itemtype="<?php echo woocommerce_get_product_schema(); ?> " id="product-<?php the_ID(); ?> " <?php post_class($articlesize . ' columns post product item ' . $animation . ''); ?> > <?php if (has_post_thumbnail()) { $thumbnail_id = get_post_thumbnail_id(); $image = wp_get_attachment_image_src($thumbnail_id, 'full'); $image_src = $image[0]; $image = aq_resize($image_src, $imagesize[0], $imagesize[1], true, true, true); } ?> <figure class="overlay-effect"> <img src="<?php echo $image; ?> " width="<?php echo $imagesize[0]; ?> " height="<?php echo $imagesize[1]; ?> " /> <div class="overlay"> <div class="table"> <div> <div class="child post-title<?php if ($catalog_mode == 'on') { echo ' catalog-mode'; } ?> "> <h4><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a><hr></h4> </div> <?php if ($catalog_mode != 'on') { ?> <div class="child buttons"> <?php /** * woocommerce_after_shop_loop_item_title hook * * @hooked woocommerce_template_loop_price - 10 */ do_action('woocommerce_after_shop_loop_item_title'); ?> <?php do_action('woocommerce_after_shop_loop_item'); ?> </div> <?php } ?> </div> </div> </div> </figure> </article> <?php $i++; } ?> </div><?php } } ?> <?php $out = ob_get_contents(); if (ob_get_contents()) { ob_end_clean(); } wp_reset_query(); wp_reset_postdata(); return $out; }
function thb_productgrid($atts, $content = null) { extract(shortcode_atts(array('product_sort' => 'best-sellers', 'item_count' => '8', 'cat' => '', 'product_ids' => ''), $atts)); global $woocommerce, $woocommerce_loop; if ($product_sort == "latest-products") { $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $item_count); } else { if ($product_sort == "featured-products") { $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'meta_key' => '_featured', 'meta_value' => 'yes', 'posts_per_page' => $item_count); } else { if ($product_sort == "top-rated") { add_filter('posts_clauses', array($woocommerce->query, 'order_by_rating_post_clauses')); $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $item_count); $args['meta_query'] = $woocommerce->query->get_meta_query(); } else { if ($product_sort == "sale-products") { $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $item_count, 'meta_query' => array(array('key' => '_sale_price', 'value' => 0, 'compare' => '>', 'type' => 'NUMERIC'), array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN'))); } else { if ($product_sort == "by-category") { $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'product_cat' => $cat, 'posts_per_page' => $item_count); } else { if ($product_sort == "by-id") { $product_id_array = explode(',', $product_ids); $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'post__in' => $product_id_array); } else { $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $item_count, 'meta_key' => 'total_sales', 'orderby' => 'meta_value'); } } } } } } $products = new WP_Query($args); $woocommerce_loop['columns'] = apply_filters('loop_shop_columns', '3'); ob_start(); $i = 1; if ($products->have_posts()) { ?> <div class="products row packery"> <?php while ($products->have_posts()) { $products->the_post(); ?> <?php global $product, $post; $font; switch ($i) { case 1: case 13: $imagesize = array("570", "600"); $font = 'large'; $articlesize = 'small-12 medium-6'; break; case 2: case 4: case 5: case 6: case 9: case 8: case 10: case 11: case 14: case 15: $imagesize = array("270", "285"); $font = 'small'; $articlesize = 'small-12 medium-3'; break; case 3: case 7: case 12: $imagesize = array("270", "600"); $articlesize = 'small-12 medium-3'; $font = 'medium'; break; } ?> <article itemscope itemtype="<?php echo woocommerce_get_product_schema(); ?> " id="product-<?php the_ID(); ?> " <?php post_class($articlesize . ' columns'); ?> > <?php if (has_post_thumbnail()) { $image_id = get_post_thumbnail_id(); $image_link = wp_get_attachment_image_src($image_id, 'full'); $image = aq_resize($image_link[0], $imagesize[0], $imagesize[1], true, false); } ?> <figure> <img src="<?php echo $image[0]; ?> " width="<?php echo $image[1]; ?> " height="<?php echo $image[2]; ?> " /> <div class="overlay"> <div class="post-title<?php if ($font) { echo ' ' . $font; } ?> "> <?php $size = sizeof(get_the_terms($post->ID, 'product_cat')); echo $product->get_categories(', ', '<aside class="post_categories">' . _n('', '', $size, THB_THEME_NAME) . ' ', '</aside>'); ?> <h1><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h1> </div> </div> </figure> </article> <?php $i++; } // end of the loop. ?> </div> <?php } $out = ob_get_contents(); if (ob_get_contents()) { ob_end_clean(); } wp_reset_query(); wp_reset_postdata(); return $out; }
function thb_footer_products() { if (class_exists('woocommerce')) { $footer_products_radio = isset($_GET['footer_products_radio']) ? htmlspecialchars($_GET['footer_products_radio']) : ot_get_option('footer_products_radio'); $footer_products_sections = ot_get_option('footer_products_sections'); $footer_products_cat = ot_get_option('footer_products_categories'); $footer_products_count = ot_get_option('footer_products_count', 6); $footer_columns = ot_get_option('footer_columns', 'fourcolumns'); ?> <section id="footer_products" class="footer_products cf"> <?php if ($footer_products_radio == 'wid') { ?> <aside class="sidebar"> <?php if ($footer_columns == 'fourcolumns') { ?> <div class="small-12 medium-3 columns"> <?php dynamic_sidebar('footer1'); ?> </div> <div class="small-12 medium-3 columns"> <?php dynamic_sidebar('footer2'); ?> </div> <div class="small-12 medium-3 columns"> <?php dynamic_sidebar('footer3'); ?> </div> <div class="small-12 medium-3 columns"> <?php dynamic_sidebar('footer4'); ?> </div> <?php } elseif ($footer_columns == 'threecolumns') { ?> <div class="small-12 medium-4 columns"> <?php dynamic_sidebar('footer1'); ?> </div> <div class="small-12 medium-4 columns"> <?php dynamic_sidebar('footer2'); ?> </div> <div class="small-12 medium-4 columns"> <?php dynamic_sidebar('footer3'); ?> </div> <?php } elseif ($footer_columns == 'twocolumns') { ?> <div class="small-12 medium-6 columns"> <?php dynamic_sidebar('footer1'); ?> </div> <div class="small-12 medium-6 columns"> <?php dynamic_sidebar('footer2'); ?> </div> <?php } elseif ($footer_columns == 'doubleleft') { ?> <div class="small-12 medium-6 columns"> <?php dynamic_sidebar('footer1'); ?> </div> <div class="small-12 medium-3 columns"> <?php dynamic_sidebar('footer2'); ?> </div> <div class="small-12 medium-3 columns"> <?php dynamic_sidebar('footer3'); ?> </div> <?php } elseif ($footer_columns == 'doubleright') { ?> <div class="small-12 medium-3 columns"> <?php dynamic_sidebar('footer1'); ?> </div> <div class="small-12 medium-3 columns"> <?php dynamic_sidebar('footer2'); ?> </div> <div class="small-12 medium-6 columns"> <?php dynamic_sidebar('footer3'); ?> </div> <?php } elseif ($footer_columns == 'fivecolumns') { ?> <div class="small-12 medium-2 columns"> <?php dynamic_sidebar('footer1'); ?> </div> <div class="small-12 medium-3 columns"> <?php dynamic_sidebar('footer2'); ?> </div> <div class="small-12 medium-2 columns"> <?php dynamic_sidebar('footer3'); ?> </div> <div class="small-12 medium-3 columns"> <?php dynamic_sidebar('footer4'); ?> </div> <div class="small-12 medium-2 columns"> <?php dynamic_sidebar('footer5'); ?> </div> <?php } elseif ($footer_columns == 'onecolumns') { ?> <div class="small-12 columns"> <?php dynamic_sidebar('footer1'); ?> </div> <?php } ?> </aside> <?php } else { if ($footer_products_radio == 'just') { ?> <?php if (is_array($footer_products_sections)) { ?> <aside id="footer_tabs" class="footer_tabs"> <ul> <?php if (in_array('just-arrived', $footer_products_sections)) { ?> <li><a href="#" class="active" data-type="latest-products"><?php _e('Just Arrived', THB_THEME_NAME); ?> </a></li> <?php } ?> <?php if (in_array('best-sellers', $footer_products_sections)) { ?> <li><a href="#" <?php if (!in_array('just-arrived', $footer_products_sections)) { ?> class="active" <?php } ?> data-type="best-sellers"><?php _e('Best Sellers', THB_THEME_NAME); ?> </a></li> <?php } ?> <?php if (in_array('featured', $footer_products_sections)) { ?> <li><a href="#" <?php if (!in_array('just-arrived', $footer_products_sections) && !in_array('best-sellers', $footer_products_sections)) { ?> class="active" <?php } ?> data-type="featured-products"><?php _e('Featured', THB_THEME_NAME); ?> </a></li> <?php } ?> </ul> </aside> <?php } ?> <?php if (!empty($footer_products_sections)) { ?> <?php global $post; $catalog_mode = ot_get_option('shop_catalog_mode', 'off'); $shop_product_listing = ot_get_option('shop_product_listing', 'style1'); $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $footer_products_count, 'no_found_rows' => true, 'suppress_filters' => 0); $products = new WP_Query($args); ?> <div class="carousel-container"> <div class="carousel products no-padding owl row" data-columns="6" data-navigation="true" data-loop="true" data-bgcheck="false"> <?php while ($products->have_posts()) { $products->the_post(); ?> <?php $product = get_product($products->post->ID); ?> <article itemscope itemtype="<?php echo woocommerce_get_product_schema(); ?> " <?php post_class("post small-6 medium-4 large-2 columns product " . $shop_product_listing); ?> > <?php do_action('woocommerce_before_shop_loop_item'); ?> <?php $image_html = ""; if (has_post_thumbnail()) { $image_html = wp_get_attachment_image(get_post_thumbnail_id(), 'shop_catalog'); } ?> <?php if ($shop_product_listing == 'style1') { ?> <figure class="fresco"> <?php do_action('thb_product_badge'); ?> <?php echo $image_html; ?> <div class="overlay"></div> <div class="buttons"> <?php echo thb_wishlist_button(); ?> <div class="post-title<?php if ($catalog_mode == 'on') { echo ' catalog-mode'; } ?> "> <a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a> </div> <?php if ($catalog_mode != 'on') { ?> <?php /** * woocommerce_after_shop_loop_item_title hook * * @hooked woocommerce_template_loop_price - 10 */ do_action('woocommerce_after_shop_loop_item_title'); ?> <?php do_action('woocommerce_after_shop_loop_item'); ?> <?php } ?> </div> </figure> <?php } else { if ($shop_product_listing == 'style2') { ?> <figure class="fresco"> <?php do_action('thb_product_badge'); ?> <a href="<?php the_permalink(); ?> "><?php echo $image_html; ?> </a> </figure> <div class="post-title<?php if ($catalog_mode == 'on') { echo ' catalog-mode'; } ?> "> <a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a> </div> <?php if ($catalog_mode != 'on') { ?> <?php /** * woocommerce_after_shop_loop_item_title hook * * @hooked woocommerce_template_loop_price - 10 */ do_action('woocommerce_after_shop_loop_item_title'); ?> <?php do_action('woocommerce_after_shop_loop_item'); ?> <?php } ?> <?php } } ?> </article><!-- end product --> <?php } // end of the loop. ?> </div> <div class="ai-dotted ai-indicator"><span class="ai-inner1"></span><span class="ai-inner2"></span><span class="ai-inner3"></span></div> </div> <?php } ?> <?php } else { if ($footer_products_radio == 'cat') { ?> <?php if (is_array($footer_products_cat)) { ?> <aside id="footer_tabs" class="footer_tabs"> <ul> <?php $i = 0; foreach ($footer_products_cat as $cat) { ?> <?php $category = get_term_by('id', $cat, 'product_cat'); ?> <li><a href="#"<?php if ($i == 0) { echo ' class="active"'; } ?> data-type="<?php echo $cat; ?> "><?php echo $category->name; ?> </a></li> <?php $i++; } ?> </ul> </aside> <?php } ?> <?php if (!empty($footer_products_cat)) { ?> <?php global $post; $catalog_mode = ot_get_option('shop_catalog_mode', 'off'); $category = get_term_by('id', reset($footer_products_cat), 'product_cat'); $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'product_cat' => $category->slug, 'posts_per_page' => $footer_products_count, 'no_found_rows' => true, 'suppress_filters' => 0); $products = new WP_Query($args); ?> <div class="carousel-container"> <div class="carousel products no-padding owl row" data-columns="6" data-navigation="true" data-bgcheck="false"> <?php while ($products->have_posts()) { $products->the_post(); ?> <?php $product = get_product($products->post->ID); ?> <article itemscope itemtype="<?php echo woocommerce_get_product_schema(); ?> " <?php post_class("post small-6 medium-4 large-2 columns product"); ?> > <?php do_action('woocommerce_before_shop_loop_item'); ?> <figure class="fresco"> <?php $image_html = ""; do_action('thb_product_badge'); if (has_post_thumbnail()) { $image_html = wp_get_attachment_image(get_post_thumbnail_id(), 'shop_catalog'); } ?> <?php echo $image_html; ?> <div class="overlay"> <a class="quick quick-view" data-id="<?php echo $post->ID; ?> " href="#"><i class="icon-budicon-545"></i></a> </div> <div class="buttons"> <?php echo thb_wishlist_button(); ?> <div class="post-title<?php if ($catalog_mode == 'on') { echo ' catalog-mode'; } ?> "> <a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a> </div> <?php if ($catalog_mode != 'on') { ?> <?php /** * woocommerce_after_shop_loop_item_title hook * * @hooked woocommerce_template_loop_price - 10 */ do_action('woocommerce_after_shop_loop_item_title'); ?> <?php do_action('woocommerce_after_shop_loop_item'); ?> <?php } ?> </div> </figure> </article><!-- end product --> <?php } // end of the loop. ?> </div> <div class="ai-dotted ai-indicator"><span class="ai-inner1"></span><span class="ai-inner2"></span><span class="ai-inner3"></span></div> </div> <?php } ?> <?php } } } // $footer_products_radio ?> </section> <?php } }