Using post thumbnails outside the loop
-
Hey everyone. What I’m trying to do is use the new post thumbnails feature in conjunction with the WordPress.com Stats plugin. I’m using this code to grab the most popular posts and display them on one of my pages:
<h4>Most Popular</h4> <ul> <?php foreach($top_posts = stats_get_csv('postviews', "days=7") as $post): if(!get_post($post['post_id'])) continue; ?> <li><a href="<?php echo $post['post_permalink']; ?>"><?php echo $post['post_title']; ?></a></li> <?php endforeach; ?>
That is working and displaying the posts perfectly fine. However, what I’m trying to do is represent each post by a thumbnail instead of the post title. I’ve tried squeezing <?php the_post_thumbnail(); ?> in there, but it doesn’t seem to be working.
Is this even possible to do? Any help is appreciated.
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Using post thumbnails outside the loop’ is closed to new replies.