Show vendor products in a loop
-
I’m trying to create a custom template page and I wan to show a products of a single vendor in a list.
I’m trying with this loop, but this show all products and didn’t get the vendor ID i pass in a variable
<?php $id_vendor = get_field('id_venditore'); $args = array( 'post_type' => 'product', 'tax_query' => array( 'taxonomy' => 'yith_shop_vendor', 'field' => 'id', 'terms' => '$id_vendor', ), ); $loop = new WP_Query( $args ); if ( $loop->have_posts() ) { while ( $loop->have_posts() ) : $loop->the_post(); ?> <?php the_title(); ?> <?php echo $id_vendor; ?> <?php endwhile; } else { echo __( 'No products found' ); } wp_reset_postdata(); ?>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Show vendor products in a loop’ is closed to new replies.