Simple Query Confusion!
-
Just trying to get a single random post of the post type ‘quote’ to come up in my sidebar, pretty common right!? Well I had something working with pulling all quotes using post_type code, but I’ve broken it with this:
$quotesQuery = new WP_Query( array ( 'orderby' => 'rand', 'posts_per_page' => '1' ) ); while ( $quotesQuery->have_posts() ) : $quotesQuery->the_post(); if(has_post_format( 'quote' )) { print "<div class='testimonial'>"; print "<p>"; the_content(); print "</p>"; print "<p class='testimonial_author'>"; the_title(); print "</p>"; print "</div>"; } endwhile;
What am I blind to?
thanks!
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Simple Query Confusion!’ is closed to new replies.