WP_Query orderby rand isn't working?
-
Hello,
can anyone please advise why this is not working? It is just showing the same post each page refresh rather than a new random one from the list.
<?php $loop = new WP_Query( array( 'post_type' => 'testimonials', 'posts_per_page' => 1, 'orderby' => 'rand' ) ); ?> <?php while( $loop->have_posts() ) : $loop->the_post(); ?> <div class="quote_bubble"><?php the_content(); ?></div> <div class="speech_bubble_credit"><?php the_field('testimonial_name'); ?><br /> <?php the_field('testimonial_job_company'); ?>, <?php the_field('testimonial_company'); ?></div> <?php endwhile; wp_reset_query(); ?>
Any ideas anyone please?
Thanks!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘WP_Query orderby rand isn't working?’ is closed to new replies.