Xila of Dev biznet
5/7/2020 - 9:12 AM

Tax_query Wp_query

<?php
					$args = array(
						'post_type' => 'post',
						'posts_per_page' => 3,
						'tax_query' => array(
							array(
								'taxonomy' => 'type-de-vins',
								'field'    => 'term_id',
								'terms'    => $term->term_id
							),
						),
					);
					$query = new WP_Query( $args );

					if ( $query->have_posts() ) {
						echo '<ul>';
						while ( $query->have_posts() ) {
							$query->the_post();
							echo '<li>' . get_the_title() . '</li>';
						}
						echo '</ul>';
					} else {
						// no posts found
					}
					wp_reset_postdata();
				?>