Created
December 29, 2016 05:38
-
-
Save sudipbd/7d3b14014b10e341eaa733759dc8c634 to your computer and use it in GitHub Desktop.
WordPress loop with woocommerce product category
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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