Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
WooCommerce Featured Image Loop
<?php //<~ don't add me in
add_shortcode ('woo_featured_image', 'woo_featured_image_loop' );
* Create WooCommerce Featured Image Loop Slider
function woo_featured_image_loop() {
// Setup your custom query
$args = array( 'post_type' => 'product'); // Swap to Product
$loop = new WP_Query( $args );
echo '<div class="featured-product-slider">'; // Give you slider container a CSS class
while ( $loop->have_posts() ) : $loop->the_post(); ?>
<div> <a href="<?php echo get_permalink( $loop->post->ID ) ?>">
<?php the_post_thumbnail('large'); ?></a>
echo '</div>';
return ob_get_clean();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment