I have this code that picks a random testimonial post.
<?php $quote_args = array( 'post_type' => 'post', 'category' => 'quote', 'orderby' => 'rand', 'posts_per_page' => 1 ); $quote = new WP_Query($quote_args); if($quote->have_posts()): while($quote->have_posts()): $quote->the_post(); ?> <p id="quote"> <?php the_content_rss(); ?> <span><?php echo the_title(); ?></span> </p> <?php endwhile; endif; wp_reset_postdata(); ?>
The testimonials are posts with a category of 'quote', the title of the post is the name of the person.
I have other posts in the site that have other categories but only the testimonial posts have a category of 'quote'.
The code works but I'm getting a random post picked from all the posts and not just the post's with a quote category.
Can anyone see a reason why I getting this, or any other reason this is happening