I have searched high and low for a solution and couldn't find anything; hopefully someone here more skilled than myself can lend a hand.
I have two testimonial videos (from a video custom post type) displayed randomly every time the page loads. There are different clients that have testimonials and in some cases, there are multiple testimonials from the same client.
I have the query working that randomly displays two videos from the custom post type (while filtering out a category completely). What I'm trying to avoid is loading two testimonial videos from the same client (looks odd to have two of the same thumbnails show) but I'm not sure how to do this. Here the working code that I have so far:
<?php $loop = new WP_Query(array(
'post_type' => 'video',
'posts_per_page' => 2,
'orderby' => 'rand',
'tax_query' => array(
array(
'taxonomy' => 'video_category',
'field' => 'slug',
'terms' => 'assess-core-certification',
'operator' => 'NOT IN')
)
));
?>
<?php if ( $loop ) : while ( $loop->have_posts() ) : $loop->the_post(); ?>
<div class="testimonialVideo top">
<div class="testimonialVideo-video"><?php the_content(); ?></div>
<div class="testimonialVideo-title">
<strong><?php echo get_post_meta( get_the_ID(), 'video_clientName', true ) ?></strong><br/>
<span class="small"><?php echo get_post_meta( get_the_ID(), 'video_clientCompany', true ) ?><br/><br/>
"<em><?php echo get_post_meta( get_the_ID(), 'video_shortQuote', true ) ?></em>"</span>
</div>
</div>
<?php endwhile; else: ?>
<p class="error-not-found">Sorry, no testimonials found.</p>
<?php endif; wp_reset_postdata();?>
video_clientName
meta values, right? So that 2 of the samevideo_clientName
do not show up in your list?$wpdb
to pullDINSTINCT
values.