How to Get Most Commented Posts with Thumbnail


Sponsored Links






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&quot; 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

Subscribe to Full RSS Feed

RSS FeedIf you thing this article useful, please consider subscribing to our RSS Feed or e-mail updates and stay updated with us. You can also follow @WPTricksNet on twitter for latest updates.

About WP Tricks

We are WordPress Family, we collected and writed useful tips and tricks for you WordPress. We share it for you...

Related Tips and Trick from Local Data and on The Net

It’s All About Post Thumbnail

WordPress 2.9 built in new features, like Online Image editor and Post Thumbnail, On this post I will give some information about post that coverage Post Thumbnail, So, if you need to know about Post Thumbnail and add your theme … Read More

Automatically Create a Custom Field

WP Canyon did wonderful tricks, this tricks is about how to automatically create a custom field when a post is published. This wonderful method is added some code on your functions.php files on your current theme. The first time need … Read More

Added Custom Size on Your Post Thumbnails

Chadcoleman created wonderful tutorials, how to added Custom Size Post Thumbnail. All we need to do only put some functions and use it whatever and whenever you want. Added this code on your functions.php That it's, you have new custom

Post Thumbnail on RSS Feed

Jeff Starr give nice tricks how To Added Post Tumbnail in our RSS Feed, and I will show you on today wordpress tips. This code only need tiny hack, we put some code in our functions.php and the code will … Read More

How To Automatically add Twitter and Facebook buttons to your posts

How To Automatically add Twitter and Facebook buttons to your posts, this trick original created by Dev7Studios and I will share it again for you. Like on many many WP Tutorials that I was write on WP Tricks, you need … Read More

How To Create Popular Post without Plugin

Today WP Tricks is how to create popular post without any plugin. We need to run little bit query using some code and place this code on whatever you want to put on. Example we can put this code on … Read More

How to Get Most Commented Posts with Thumbnail / WordPress Tricks

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 read more

Source: http://wptricks.net/how-to-get-most-commented-posts-with-thumbnail/

WordPress › Most Commented Widget « WordPress Plugins

[Plugin: Most Commented Widget] how to exclude post-id? [Plugin: SEO Facebook Notice: Undefined index: plugins in []plugins.php; Most read posts with thumbnail read more

Source: http://wordpress.org/extend/plugins/most-commented/

It's All About Post Thumbnail / WordPress Tricks & Tips

How to Get Most Commented Posts with Thumbnail. There are so many way to attract visitor on your WordPress blog, the one of them is show most popular post on your sidebar read more

Source: http://wptricks.net/its-all-about-post-thumbnail/

Most Commented Posts The Right Way in WordPress - WPShout.com

is no longer needed as WordPress' query_posts can now display your most commented posts. Image/Thumbnail option, would it not be more efficient to call that thumbnail read more

Source: http://wpshout.com/most-commented-posts-the-right-way-in-wordpress/

Get thumbnails from specific wordpress posts : Live Experience

Each thumbnail contains a link to read the associated post. Notice that this code get thumbnails from the ten most commented posts, but you can easily modify the read more

Source: http://www.livexp.net/wordpress/get-thumbnails-from-specific-wordpress-posts.html


7 Responses to How to Get Most Commented Posts with Thumbnail

  1. dNoxs says:

    thanks for tricks…

    I have bookmarks it

  2. Pingback: Display Recent Comment with Gravatar without plugin # WordPress Tricks & Tips

  3. saç ekimi says:

    Hi all
    very nices post.
    thank admin

  4. Yes , i agree that showing latest comments attract more visitors and keep their interest. thanks for the code.

  5. it’s not working for my blog
    plz help me

    waiting for ur anwser

  6. Puneet says:

    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.

  7. Excellent article, thanks very much for this information.
    Happy to have found this post.It’s interest.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>