How to display Wishlist button in WP query?
-
Hi, I need to use WP Query (its requirement to use it, i cant use [products] shortcode!) to list my products in custom loop.
<?php $params = array('posts_per_page' => 5); $wc_query = new WP_Query($params); ?> <?php if ($wc_query->have_posts()) : ?> <?php while ($wc_query->have_posts()) : $wc_query->the_post(); ?> <?php the_title(); ?> // and here i want a button 'add to wishlist' <?php endwhile; ?> <?php wp_reset_postdata(); ?> <?php else: ?> <p><?php _e( 'No products here' ); ?></p> <?php endif; ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How to display Wishlist button in WP query?’ is closed to new replies.