I haven’t kept on top of my promise to become more regular with my articles on this blog, I’ve relied heavily on guest posts and I’m hoping to correct this very soon. In the mean time I thought I would answer a common request and post a useful trick for displaying the most popular posts on your blog.
If you look at the top of this blog you will see a section that is called ‘The Most Popular Articles On IND Today’ this is a list of the seven most commented on posts on my blog. People often ask me how I managed to do this.
Well here it is.
You simply insert the following code into your sidebar, or whichever file you wish (header, footer, etc), don’t forget to change the amount of posts to show, I have seven listed but you might want more or less.
[sourcecode language='css']
The Most Popular Articles On IND Today
-
get_results(“SELECT comment_count,ID,post_title FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0 , 5″);
- casters fell off my chair. Everything seems to be going wrong at the moment!
foreach ($result as $post) {
setup_postdata($post);
$postid = $post->ID;
$title = $post->post_title;
$commentcount = $post->comment_count;
if ($commentcount != 0) { ?>
I am a 33 year old full-time freelancer & blogger from East London, United Kingdom, who has been working online since early 2001.
{ 3 comments… read them below or add one }
That’s a nifty little code. I had been weekly updating the popular posts list before I took it down because of the useless work involved. Now I need to figure out a way to get this as a sidebar widget. I guess I’ll need to tweak the widgets.php file or something.

Abdul Rehman recently posted..Higher Bounce Rate More Money
Thank you Abdul. Thanks for dropping by, you have an awesome blog.
I haven’t read this post completely (and I suck at PHP code) but would this be of interest to you?
It would also be nice if there is a list of your recent blog posts at the side to make it complete.