One of the things your blog readers don’t have is time. That’s time to wade through your 500 or so posts to pick the golden posts that declare your blog “add to my feed reader” worthy. You need a way to present your top posts up front and you need an easy and automated way to do it. Lucky for you Wordpress fanatics, help is definitely around the corner.
I present to you the Top Post by Category plugin. This baby allows Wordpress bloggers to display their best posts, as determined by the number of visits to the post or number of comments.
Download the plugin here.
You can view my own top posts page (by number of comments) in action here.
Plugin Features
- You can choose between displaying top visited posts or top commented posts.
- You can choose to diplay top posts by category or you can display the top posts regardless of category (or as I would like to call it ala Royal Rumble)
- You can choose to display the actual number of visits or comments for each post featured on the best list.
- You can control the number of top posts to display, i.e. display N top posts per category.
Installation
- Upload to your plugins folder
- Activate the plugin.
- Go to OPTIONS > Top Post to customize options
How to Insert the Top Posts by Category Code
- To display your Top Posts list on your sidebar, put <?php tpbc_list ();?> where you want the list to show up.
- To display your Top Posts list within a page or within a post, edit the particular page or post, then put [ tpbc_list ] (remove spaces) where you want the list to show up.
Extra Bonus
The TPBC plugin uses its own visits counter. To display the “Visited N times” on your post pages like on my blog, just add <?php tpbc_visits (); ?> to your post template.
Comments and Suggestions
Please, by all means, send your comments and suggestions on how to improve this plugin!
Hat tip to my buddy Todd for his best posts page article, the inspiration behind the Top Posts by Category plugin.
And now the fineprint:
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.










February 1st, 2007 at 8:57 am
This looks very handy
I haven’t looked at the code yet, but will it also work with tag pages from UTW, so you have best posts in Tag?
February 1st, 2007 at 9:08 am
Also one thing I forgot to mention. Unless you intend some kind of commercial exploitation, it is quite often easier just to use a GPL license for plugins.
You don’t have any real copyright / usage clauses there yet, though I haven’t looked at the download package.
February 1st, 2007 at 12:44 pm
I have been looking for this for months now dude! thanks!
i tried to use extended live from http://www.sonsofskadi.net/extended-live-archive/ but i cant make it work. right now im using http://www.sporadicnonsense.com/2005/04/28/clean-archives-plug-in/ but i need to sort it in category.
i noticed that not all posts are displayed here. is it possible to show all my posts?
February 1st, 2007 at 3:10 pm
Hi
Where abouts should I add this code to my post template?:
Cheers
February 1st, 2007 at 5:33 pm
Andy, re: UTW integration, will look into providing that functionality for the next upgrade. Also, thanks for the GPL advice
Alfredo, well you can ‘widen’ the net manually by entering a high value in the number of posts to display field.
SP, which specific code are you talking about?
February 1st, 2007 at 8:57 pm
Sorry Marc, I cut and pasted the code but it disappeared from my comment once I hit submit. The code I was talking about was the ‘extra bonus’ code.
Cheers
February 1st, 2007 at 10:59 pm
Sshhweeettt!!!!
February 2nd, 2007 at 5:12 am
Great plugin - already using it but any way to display BOTH lists - top posts by comments AND top posts by views?
February 2nd, 2007 at 5:24 am
Already using this plugin to create a top ten page, I couldn’t figure out how to do that easily with Popularity Contest. But, can one exclude categories from the page, or re-order them? What about excluding individual posts?
db
February 2nd, 2007 at 6:35 am
SP, for my blog I placed it inside the loop of single.php and index.php like so:
<h2 id="post-<?php the_ID(); ?>"><a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h2>
February 2nd, 2007 at 6:39 am
Grant, not at the moment, but I’ve queued your request for the next release
David, I’ve received a couple of requests very similar to yours. These functionalities (ability to select/suppress categories and/or posts, customized category order) will definitely be on the next version.
Thanks for trying out the plugin guys!
February 2nd, 2007 at 3:49 pm
Marc - I don’t know how you feel about linking other sites but I found another plugin that I’m using with yours to get both or those lists - views and comments.
here’s the link - http://www.lambic.co.uk/blog/wordpress-plugins
you can delete this if you want but that you might like to know.
I use yours for “top by views” and this other one for “top by comments”
I think your management/dashboard is better.
February 2nd, 2007 at 4:35 pm
Grant, perfectly all right with me
February 2nd, 2007 at 6:27 pm
I’ll check back soon for the next version.
One thing, the page I made doesn’t render Adsense for some reason…I disabled it now, so no need to look, but has anyone else noticed this prob?
db
February 3rd, 2007 at 9:50 am
Thanks Marc, I got it working!
February 3rd, 2007 at 6:49 pm
Is it compatible with WP2.1?
February 4th, 2007 at 5:36 pm
Awesome plug-in! Any chance you can make it into a widget?
February 6th, 2007 at 11:08 am
Does it show the first time it’s activated? Cause mine doesn’t show at all… not even the [ tpbc_list ] (without the spaces). I’m using WP 2.1 by the way, does it work on that version?
Thanks in advance!
February 7th, 2007 at 10:34 am
howcome when i use
it does not show up in my sidebar.
I’m using it in conjunction of the sidebar widgets plugin.
my site is http://www.vistarewired.com
February 7th, 2007 at 5:42 pm
Good plugin - works perfectly - THANK YOU!
February 9th, 2007 at 10:08 am
Hmm I set up a page with the
[tpbc_list] code, and it is showing a blank. Does it take awhile for the plugin to amass stats, as far as which posts are the most popular? I just want to make sure the plugin is acting normally for now.
February 11th, 2007 at 9:27 pm
What does it show when a post is submitted to more than one category?
February 11th, 2007 at 10:36 pm
It’s not showing anything for me either… What’s happening with it?
This plugin would be really really helpful if I can get it to work :p
February 15th, 2007 at 1:43 pm
Marc: Big thanks for the plugin! I plopped it in the directory and had it running in 20 seconds flat. That’s great work.
Running on WP 2.1, K2 based theme with no problems so far.
I would love a feature to manually input weights on certain posts from the past so that I could instantly bring up old posts. Other than that, the ease with which this installs makes it much easier than dealing with Most Wanted (requires another plugin and patience) or Popularity (won’t run on my customized K2).
February 18th, 2007 at 3:59 pm
I can’t get the code to work either. Is this because of widgets?
February 19th, 2007 at 5:15 am
fabulous.
February 21st, 2007 at 12:47 am
i have been putzing around with this for a few days now and noticed something that you might want to fix.
i was working on a long post over the course of the day and noticed that this post was popping up in the list even though it was not published. at first i thought it was only showing it to me since i was logged into my WP install, but even after i logged out it was still there, and to my dismay clicking the link displayed the unpublished post.
also, maybe adding an option for ip blocking would help?
one other thing that would be really nice is if you had the option to display your top posts both by visit and by comment count, instead of one or the other. don’t know if it’s feasible, but it would be cool.
February 23rd, 2007 at 8:18 am
Hi Marc,
Great looking plugin but I’m having problems syncing with the db. I’m using wp 2.0.4 and getting the errors seen here: http://blog.abcpsr.com/top-plastic-surgery-posts/
Can you help? Sorry PHP novice.
February 23rd, 2007 at 8:32 am
whoops had to take page down. This was the error I got: WordPress database error: [Table 'abcpsr.wp_tpbc' doesn't exist]
February 26th, 2007 at 8:21 pm
Here you have my top in case you’re interested
http://www.w3top.org
February 27th, 2007 at 12:39 am
I was so excited to see how it works but I can’t see the display yet. Hmmm.. Does it work on 2.1 (somebody else has already said yes bakit ba ang kulit ko? hehe)
Im wondering why a lot of 2.1 users are having probs with this one.
February 27th, 2007 at 8:52 am
Hey there
How do I get this plugin to just show certain categories? eg. I don’t want to show the ‘uncategorized’ category cos it seems to be picking up attachments etc.
see here: http://www.swollenpickles.com/top-posts
cheers
February 27th, 2007 at 10:45 am
Awesome plugin, wish I knew about this earlier.
February 28th, 2007 at 2:07 pm
wp_tpbc 68,242 MyISAM utf8_spanish_ci 15.9 MiB
What is this mean? it means that the plugin doesn´t have a FLUSH button to delete the logs, so the database has grow 16MB only in that table.
Great plugin, but I don´t want my DB weight hundreds of MB just because this plugin.
Cheers!
February 28th, 2007 at 10:29 pm
problem, it publishes drafts. Might not be a problem once a blog is established, but for a new site, unpublished stories should not show up. I also post date a lot of stuff, and it’s showing up
March 2nd, 2007 at 5:53 am
Hi All
My problem is it won’t stop. I installed as a php module in sidebar’s modules on K2 and it works except it doesn’t recognise the show “x” posts.
It just keeps showing all in a long list.
Help…….please !!!
March 2nd, 2007 at 2:43 pm
Yeah i also have the same problem as mentioned by ozpoker. Can I make in the sidebar to list overall top 10 posts and in the top-post page to list it by category?
March 6th, 2007 at 3:47 am
Hey, is it easy to modify this so that it displays most recent posts instead of most viewed? That would be intensely brilliant.
March 8th, 2007 at 11:32 am
I got another prob. now - Top posts is not showing in the sidebar on pages.
It shows on posts but not pages.
Any thoughts ?
March 9th, 2007 at 8:35 am
I have a prob:
When I enable: Should I group by category?
It links the Category Heading as the first post….and the first post in the category is not linked.
HELP.
March 13th, 2007 at 4:32 am
Hi man. Its a very cool plugin. Thanks for making it.
March 14th, 2007 at 4:55 am
Right now I have my “best of” listed on the top of my left sidebar. Click here to view.
I also want to create a “Best of” page, but am running into a problem.
On the best of page I want to list by category…and list the top 5 in each category.
On the sidebar, I just want to list the top ten overall.
My problem is…there is only one configuration in the options…and I can’t do both. Is there any way around this?
March 22nd, 2007 at 9:23 am
Thanks dude. This one of the best plugin i’ve ever seen. Gotta try it soon on my website.
March 25th, 2007 at 8:54 am
Hi,
Congratulations for being a finalist for the Philippine Blog Awards 2007 under the Best Plugin Category.
I’m Moslemen “Jun” Macarambon Jr. part of the organizing team and committee for the Awards Night.
I’m making the rounds to gather the contact info and establish direct communication with the finalists. This will give us an avenue to give instructions and other details.
May we ask for the following please?
Real Name:
Email address:
Mobile Number:
City and Country where you are based:
Once this is settled, we’ll know where to communicate the Awards Night details with.
We hope to hear from you soon. All the best to you and your blog.
Email me the details here jun [at] wyzemoro [dot] com
March 30th, 2007 at 9:09 am
this plugin really rocks!! love it! like it! wanna try it soon!
April 1st, 2007 at 4:46 am
Hey is there a way to reset the counter on this plug in, because i want to display top monthly post on my website and would like to reset it every month.
Thanks
Great Plugin
April 1st, 2007 at 11:01 am
Very nice plug ins , i all ready installed on my site and working fine , See a New Modify news like cms
April 3rd, 2007 at 4:36 am
is there a way to have top posts for each category instead of clumping them all together?
April 8th, 2007 at 2:09 pm
Twas surprisingly easy to use. Good one, Marc!
April 9th, 2007 at 8:15 pm
thanks so much for this plugin. i love your blog. nice to see such an accomplished blogger who helps other bloggers. and a fellow filipino as well!
thanks again!
April 20th, 2007 at 5:12 am
Well ive been using your excellent plug for some weeks now, and i came across this paradigm.—
Is there any (easy)way to reset the counter? I would like to reset them to 0 every month or so.
thanks
April 20th, 2007 at 10:17 pm
Hello,
I’m testing your plugin, but it counts (and sho) also hits on images I have in my pages ?
Regards
Frank
April 30th, 2007 at 11:17 pm
Hi, I added your plugin to my blog a few days ago and I’ve already noticed improvements to the number of visits I’m getting on older posts. There are some great comments here about extending the functionality too… have you considered an update? Anyway great job and thanks for the plugin.
May 1st, 2007 at 4:44 am
does the plugin works perfectly with wp-cache cahed pages?
May 3rd, 2007 at 12:57 am
Hi!
Is there a chance to get the most popular topics from a month, not from a category?
I want to have a archive page, where i can show my readers the most popular topics each month.
I Hope you have an idea if it is possible.
Greetings from Vienna
May 11th, 2007 at 1:56 am
Thanks for this plugin. I’ve installed it on a few of the blogs I run. Great work!
May 11th, 2007 at 8:06 pm
Excellent plugin.
May 14th, 2007 at 6:55 pm
Wow, nice. Thanks for the great plug-in!
May 15th, 2007 at 8:18 pm
Great plug-in! I’ve been looking for something like that for months. Thanks
May 17th, 2007 at 1:57 pm
Got a request:
Could you somehow rework this for a low DB usage? Do we really need to track IPs, and dates, and times? It’s really killing my database right now. It can’t even be emailed anymore and 85% of the size is due to this plugin.
Can’t we just have one record for post with a simple counter?
ThanX
May 23rd, 2007 at 10:06 am
TQ for the plug in yer
May 23rd, 2007 at 10:07 am
i will try this at my blog, tq for your plugin.
May 23rd, 2007 at 10:27 pm
For some reason I am having a hard time with this. I can not get it to work. What code do I use and where does it go?
I am confused
May 24th, 2007 at 11:46 am
Thanks Marc,
I really love it. I put the visited counter along my title and the Top Post by Category plugin works very well in my single page!
Thanks again!
May 25th, 2007 at 10:36 pm
This is perfect, Marc — I was having trouble getting Alex’s Popularity plug-in to do what yours does. It was literally a two-minute install…
- download
- unzip
- upload the one file
- activate
- configure in ‘Options’
- paste code into sidebar.php
… and it’s looking perfect.
Thanks so much!
May 30th, 2007 at 5:03 am
Many thanks for the info
will be testing out the plugin as a priority on one of my bloggs
May 31st, 2007 at 3:39 pm
First of all l would likt to thank you about this good tool. l am using it for 3 days. l would like to ask you how to deactive the page visited counter? cos when l checked from crawled index from google “visits” keyword became is the highly the most strong keyword of my site.
How can l remove the “visits” word from this plugg-in or how can l deactive counter for plugg-in ?
thanks at all.
June 1st, 2007 at 6:57 am
there is no answer for a day ? l am waiting a solution for my request please. no webmaster no mod for this plugin ? No support ?
thanks.
June 9th, 2007 at 5:51 am
I’ve installed this plugin now and it’s just what I’ve been wanting having been let down by a similar one I tried when it failed to work for me.
This keeps things simple and does exactly what I need, thanks very much for taking the time to create it!
Much appreciated!
June 17th, 2007 at 6:04 am
Looks like there is no way to select only a specific category and not list all of them.
Not looking to list all categories just want to be able to select specific categories or place the tag on the sidebar for the category I’m looking to list with the number of posts. Seems like this is what this plugin is lacking.
June 18th, 2007 at 10:17 pm
Awesome plugin. Thank you so much. One question … could someone please advise me on how to add the date of the post next to the name of the post? I am a php novice, and I’ve tried about all I can think of.
June 20th, 2007 at 12:27 pm
Hi Marc,
I activate the plugin and paste the code into my side bar, but it doesn’t show. I use WP 2.1.
Is it not compatible with WP 2.1?
June 21st, 2007 at 10:29 am
Hi Marc,
The plugin works already.
I guess it takes time to get the top posts, doesn’t it?
July 4th, 2007 at 7:50 pm
Hi, I cant get the plugin to work properly. It inserts incorrect values for “post id” into database, ie always same post id even though different posts were viewed… plz help!
July 12th, 2007 at 5:52 am
thanks for your plugin ill try this on my site
July 13th, 2007 at 1:46 pm
Like Baz, I’m concerned by the heavy DB usage. I have 1,573 posts, 30,387 comments and 74,528 tpbc entries. More than 1/4 of my total DB space is taken up by tpbc (12 out of 40MB) and based on a query counter I have, the number of DB queries per page just about doubles when this plugin is active.
July 22nd, 2007 at 2:51 am
Great job!
Anyway, the plugin count my own visits.
in the funtion tpbc_tracker(), line 81:
if (is_single () && !is_page ())
you can change it to:
if (is_single () && !is_page () && !current_user_can(’edit_posts’))
This way your visits will not be counted.
http://opendz.tuxfamily.org/2007/07/21/top-posts-by-category-mais-sans-compter-vos-visites/ (in french)
July 25th, 2007 at 11:53 am
Your plugin gives me one serious reason to consider switching to wordpres. Hmmmm… sure you don’t plan duplicating this for blogspotties?
August 3rd, 2007 at 11:22 am
Thanks for such a great list of plugins, this list are so helpful for the new guy.
Thanks
Vic
August 16th, 2007 at 1:27 pm
hmmm good plugin. I try to use thing plugin into my site
August 21st, 2007 at 3:48 pm
Great and excellent plug in t’s realy helpful. Thanks again.
September 20th, 2007 at 8:50 am
Hi Marc,
I don’t know if your still supporting this plugin but just for your info, TPBC no longer works with WP 2.3 RC1 due to the deletion of the old pre-WP 2.3 category tables in the MySQL DB in favor of the new taxonomy tables that handle categories now.
Your plugin and the TPBC page I have on my blog has become quite popular and I’m hoping you might come up with an update. Just wondering.
September 22nd, 2007 at 4:20 pm
Amazing plugin, wish I knew about this earlier.
September 27th, 2007 at 11:44 am
Yep, broken in 2.3… please please update!
September 28th, 2007 at 9:08 pm
Thanks for this amazing plugin, but I also have problems since I updated to Wordpress 2.3.
Please fix this problem..
October 8th, 2007 at 4:18 am
I have installed the plugin but no posts are showing up. How long does it take for something to show up? I’ve clicking on some of my favorite posts for now trying to get them to show up but nothing. Please advise.
October 15th, 2007 at 6:19 pm
Takes a minute or two before the list shows up. I wish the list can be manually selected instead so that I can show the posts I want, and not by most views or comments.
October 18th, 2007 at 9:51 pm
Wondering this plugin can be used for wordpress 2.3? If cant, i will hate myself for installing 2.3!
October 21st, 2007 at 1:00 pm
Can you PLEASE get this plugin to work with the latest 2.3 of WORDPRESS? I’m dying to use it!!!
October 30th, 2007 at 4:36 am
I am using WP 2.3 and it works fine, this is just what I was looking for and more, thanks so much!
November 3rd, 2007 at 4:55 am
Please update your plugin for Wordpress 2.3.
February 14th, 2008 at 2:49 pm
Hello, I updated this plugin to work with Wordpress 2.3.x.
You can download it here:
http://www.miki.cat/index.php/top-posts-by-category-plugin/
February 18th, 2008 at 10:19 pm
A couple people on here have been looking for a version which allows category-limitations and I found this one http://wordpress.sobek.pl/sobeks-post-in-category-plugin/ which works great for that purpose.
March 3rd, 2008 at 11:11 pm
It dont shows the list of top post
plz help.
April 9th, 2008 at 4:44 am
I can’t seem to get this plugin to work correctly with Wordpress 2.5 Is it compatible with this version? I don’t receive any error messages when I use the template tag. When I use the Post snippet the actual posts, containing full content, is listed, rather than a bullet list. Thanks!
May 3rd, 2008 at 3:31 pm
Is this plugin compatible with WP 2.5
May 15th, 2008 at 2:43 pm
It’s doesnt work with Wordpress 2.5. PLUGIN FAILED. That’s what it said when i activated it. What happened here?
May 17th, 2008 at 2:40 am
I’ve just installed and configured but i cannot see my top post and my top post by views please help mee!
May 18th, 2008 at 3:28 am
I’ve found a bug with WP 2.5:
plugin shows posts under wrong categories. It happens when I visit any post and right after that I click on any category this post doesn’t belong to.
Everything else works fine.
May 18th, 2008 at 4:21 am
Sorry, that’s my bug - some mess with taxonomy happened after I imported all posts from 2.0.4 to 2.5.1 using XML
June 8th, 2008 at 4:08 pm
I think WP 2.5 has screwed alot of us with regards displaying top posts. Alex Kings version doesn’t work either.
August 18th, 2008 at 5:00 am
You should probably fix this and regenerate the demand for this plugin. It looks like a lot of people would like to use something like this, but no one can because there is no plugin for it. This one doesn’t work.
November 18th, 2008 at 5:21 am
Thus link - http://www.macalua.com/2007/02/01/top-posts-by-category-plugin - does not work…
November 27th, 2008 at 12:53 am
Yikesy, i just noticed how big the wp_tpbc table got. Any way I can clean it up? Sorry, if the answer’s somewhere already.. i must be blind. X|
December 11th, 2008 at 1:19 pm
This plugin has worked great for me, easy to install and implement, but the database usage is pretty much forcing me to disable it and look for an alternative. It was great while it lasted though. Thanks.