Skip to content

Instantly share code, notes, and snippets.

@sudipbd
Created December 29, 2016 05:38
Show Gist options
  • Save sudipbd/7d3b14014b10e341eaa733759dc8c634 to your computer and use it in GitHub Desktop.
Save sudipbd/7d3b14014b10e341eaa733759dc8c634 to your computer and use it in GitHub Desktop.
WordPress loop with woocommerce product category
<div class="promo_area">
<?php
global $post;
$args = array( 'posts_per_page' => 6, 'post_type'=> 'product', 'order' => 'DESC', 'product_cat' => 'promo', );
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post); ?>
<div class="col-md-4 col-sm-6 col-xs-12">
<div class="promo_single">
<div class="grid">
<figure class="promo_offers">
<?php the_post_thumbnail();?>
<figcaption>
<h2><?php the_title(); ?></h2>
<?php the_excerpt(); ?>
<a href="<?php the_permalink(); ?>">View more</a>
</figcaption>
</figure>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment