pierrebalian of Rocket55 Web Team
5/30/2017 - 8:28 PM

Query for custom post type in category set by acf select field

Query for custom post type in category set by acf select field

<?php 
			$testimonialcat = get_sub_field('testimonial_category');
			$loop = new WP_Query( array(
				'post_type' => 'testimonials',
				'posts_per_page' => 6,
				'tax_query' => array(
					array (
						'taxonomy' => 'testimonial_category',
						'field' => 'slug',
						'terms' => $testimonialcat,
						)
					),
				) );

				while ( $loop->have_posts() ) : $loop->the_post(); ?>
				
				<!--loop your shit here-->
				
			<?php endwhile; wp_reset_query(); ?>