Most commented posts of the last 7 days
-
Hi everybody.
I’m trying to show the most commented posts of the last week, but I’m almost giving up… No sucess. I use the timthumb together, to show automatic thumbnails of the posts at the header of my website.
The hacks that I find don’t work properly as I want. Sometimes I get the most commented posts of the week (without thumbnail), and sometimes the most commented posts ever (with thumbnail).
This is the code that I’m using. I tried other codes, but as I said, they don’t display the thumbnails. Never the most commented posts of the last week with thumbnails.
<div id="top-posts"> <?php $popular = new WP_Query('orderby=comment_count&posts_per_page=6'); ?> <?php while ($popular->have_posts()) : $popular->the_post(); ?> <div class="top-posts-2"> <?php $justanimage = get_post_meta($post->ID, 'Image', true); if ($justanimage) { ?> <?php } else { ?> <a href="<?php get_permalink(); ?>"><img src="<?php bloginfo('template_directory'); ?>/timthumb.php?src=<?php getImage('1'); ?>&w=140&h=100&zc=1" alt="thumbnail" /></a> <?php } ?> <h1> <a href="<?php get_permalink(); ?>"><?php the_title(); ?></a> </h1> </div> <?php endwhile; ?> </div>
Can somebody help me with it? Is there some special code that I could put there to show the most commented posts of the last week WITH the thumbnails working?
Thanks in advance!
- The topic ‘Most commented posts of the last 7 days’ is closed to new replies.