CPT Loop filtering by taxonomy
<!--start of cpt loop for review items-->
<?php
$testimonialsloop = new WP_Query( array(
'post_type' => 'reviews',
'posts_per_page' => 1,
'orderby' => 'rand',
'tax_query' => array(
array (
'taxonomy' => 'review_categories', //slug
'field' => 'slug', //slug, name or id
'terms' => 'ecrates' //taxonmy slug
)
)
) );
?>
<?php while ( $testimonialsloop->have_posts() ) : $testimonialsloop->the_post(); ?>
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="review">
<?php the_content(); ?>
</div>
<div class="review-meta">
<div class="stars"><?php the_field('review-stars'); ?></div>
<?php the_title( '<strong>', '</strong>' ); ?><br />
<?php the_field('review_city'); ?>
</div>
</div>
</div>
<?php endwhile; wp_reset_query(); ?>
<!--start of cpt loop for review items-->