Anyone see what’s wrong with this query?
-
I’ve been working for about 2 hours on this now. I’m trying to pull out 7 random posts and 1 custom fields (in addition to title, link to the post, ) – to display an image strip of 7 images. I am also using “get the image”. I have it working but, the query seems to be ignoring the LIMIT and ORDER BY RAND.
<?php $new_query = new WP_Query("SELECT * FROM $wpdb->posts ORDER BY RAND() LIMIT 7", ARRAY_A); ?> <?php while ($new_query->have_posts()) : $new_query->the_post(); ?> <?php get_the_image( array( 'custom_key' => array( 'thumb_gallery' ), 'default_size' => 'medium', 'width' => '100', 'height' => '100','image_scan' => true,'image_class' => 'tm_image' ) ); ?> <?php endwhile; ?>
Anyone have any ideas I’m so close now but just a little bit further to go.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Anyone see what’s wrong with this query?’ is closed to new replies.