Created
April 25, 2018 15:35
-
-
Save AnkanSoul/73d897fcaf965795c990f01f2d47c020 to your computer and use it in GitHub Desktop.
Woocommerce Featured Product
This file contains 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
<?php | |
$args = array('post_type' => 'product', | |
'meta_key' => '_featured', | |
'meta_value' => 'yes', | |
'posts_per_page' => 1 ); | |
$loop = new WP_Query( $args ); | |
if ( $loop->have_posts() ) { | |
while ( $loop->have_posts() ) : $loop->the_post(); | |
wc_get_template_part( 'content', 'product_3' ); | |
endwhile; | |
} else { | |
echo __( 'No products found' ); | |
} | |
wp_reset_postdata(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment