There are so many way to attract visitor on your WordPress blog, the one of them is show most popular post on your sidebar or footer, beside that fact in order to help your visitors finding your best content.
Let’s me share “How to get most commented posts along with their related thumbnail“, This trick need little bit code to be written on your themes files. I will show you how to do this. The first time, open your sidebar.php or footer.php or whatever files with your favorite editor. Then write down this code
<?php $popular = new WP_Query('orderby=comment_count&posts_per_page=5'); ?>
<?php while ($popular->have_posts()) : $popular->the_post(); ?>
<?php $justanimage = get_post_meta($post->ID, 'thumbnail', true);
if ($justanimage) { ?>
<img src="<?php echo get_post_meta($post->ID, "Image", true); ?>" alt="<?php the_title(); ?>" />
<?php } else { ?>
<img src="http://an-alternative-image.jpg" alt="" />
<?php } ?>
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php endwhile; ?>
That I mean, on this code above, the thumbnail is taken from custom field “thumbnail”. You can change it depend on your thumbnail custom field. Thanks for Alex Denning for share this tricks



thanks for tricks…
I have bookmarks it
Pingback: Display Recent Comment with Gravatar without plugin # WordPress Tricks & Tips
Hi all
very nices post.
thank admin
Yes , i agree that showing latest comments attract more visitors and keep their interest. thanks for the code.
it’s not working for my blog
plz help me
waiting for ur anwser
You need to check with your code. Your code display the most commented posts. If I want to display the comments and not the post, what modifications I need to make.
Excellent article, thanks very much for this information.
Happy to have found this post.It’s interest.