Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2017
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. global $product, $post;
  2. $product = new WP_Query([
  3. 'post_type' => 'product',
  4. 'stock' => 1,
  5. 'showposts' => -1,
  6. 'orderby' => 'date',
  7. 'order' => 'DESC',
  8. 'meta_query' => [['key' => '_featured', 'value' => 'yes']]
  9. ]);
  10. if ($product->have_posts()) :
  11. echo '<div class="row"><div class="container"><div class="product-loop item"><div class="lSSlideOuter"><ul id="product-feature" class="content-slider">';
  12. while ($product->have_posts()) : $product->the_post();
  13. ?>
  14. <li>
  15. <?php
  16. echo '<a href="' . get_the_permalink($product->post->ID) . '">';
  17. if (has_post_thumbnail($product->post->ID)) {
  18. echo get_the_post_thumbnail($product->post->ID, 'shop_catalog');
  19. } else {
  20. echo '<img src="' . woocommerce_placeholder_img_src() . '" /></a>';
  21. }
  22. echo '</a>';
  23. ?>
  24. <div class="product-loop-meta">
  25. <h3><?php the_title(); ?></h3>
  26. <span class="sku_wrapper"><?php _e('SKU:', 'woocommerce'); ?><span class="sku" itemprop="sku"><?php echo ( $sku = $product->get_sku() ) ? $sku : __('N/A', 'woocommerce'); ?></span>.
  27. </span>
  28. <?php woocommerce_template_loop_add_to_cart($product->post, $product); ?>
  29. </div>
  30. </li>
  31. <?php endwhile; wp_reset_query(); echo '</ul></div></div></div></div>';endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement