Get_posts, random posts, and thumbnails
-
Hello again
At the top of my single pages, a narrow horizontal template displays 5 random links.
<?php global $post; $rand_posts = get_posts('numberposts=5&orderby=rand'); foreach( $rand_posts as $post ) : ?> [DISPLAY] <?php endforeach; ?>
Works fine BUT : I need to display the title AND the thumbnail of the post.
? I do get five random titles and links.
? But the_post_thumbail() returns the thumbnail for the single page I am on (remember, we are on my single pages). It obviously draws info from the query, not from the “get_posts”. Result : I have the five same pictures at the top of my page (and in the main post as well).
– What is the good solution ?
– What does GET_POSTS do that I don’t understand ?
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Get_posts, random posts, and thumbnails’ is closed to new replies.