Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- global $product, $post;
- $product = new WP_Query([
- 'post_type' => 'product',
- 'stock' => 1,
- 'showposts' => -1,
- 'orderby' => 'date',
- 'order' => 'DESC',
- 'meta_query' => [['key' => '_featured', 'value' => 'yes']]
- ]);
- if ($product->have_posts()) :
- echo '<div class="row"><div class="container"><div class="product-loop item"><div class="lSSlideOuter"><ul id="product-feature" class="content-slider">';
- while ($product->have_posts()) : $product->the_post();
- ?>
- <li>
- <?php
- echo '<a href="' . get_the_permalink($product->post->ID) . '">';
- if (has_post_thumbnail($product->post->ID)) {
- echo get_the_post_thumbnail($product->post->ID, 'shop_catalog');
- } else {
- echo '<img src="' . woocommerce_placeholder_img_src() . '" /></a>';
- }
- echo '</a>';
- ?>
- <div class="product-loop-meta">
- <h3><?php the_title(); ?></h3>
- <span class="sku_wrapper"><?php _e('SKU:', 'woocommerce'); ?><span class="sku" itemprop="sku"><?php echo ( $sku = $product->get_sku() ) ? $sku : __('N/A', 'woocommerce'); ?></span>.
- </span>
- <?php woocommerce_template_loop_add_to_cart($product->post, $product); ?>
- </div>
- </li>
- <?php endwhile; wp_reset_query(); echo '</ul></div></div></div></div>';endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement