About
Contact
Archives

Category Post Count

2004.10.20.23.01

I stole a few lines from GaMerZ’s WP-Stats plugin and repackaged it into a Category Post Count plugin [see the sidebar] that enables you to display the number of posts in each category on the right side of the list.

If you’re interested in using the plugin post a comment or email me!

Here’s the code, copy and paste into a text editor and save as cpcount.php, then upload to your plugins directory and activate from your WP panel.

Update: Apparently WP comes with a built-in feature to do this [my bad!], but mine is presented in a slightly different visual style! :-P

{ 13 comments… read them below or add one }

Naina October 20, 2004 at 11:41pm

Hi there – I would love to have the plugin…
Thanks in advance!

Reply

Mr. Dew October 20, 2004 at 11:50pm

you can use
<?php list_cats(‘optioncount=1′); ?> i think

Reply

Julia Williams November 22, 2004 at 10:21pm

Thanks, I’ve been looking for something like this. I tried to move the count a little to the left, though, and couldn’t figure that one out, but I do love having the count.

Reply

JErm November 22, 2004 at 10:32pm

NP Julia, glad to have helped! :D

You could move them a little to the left by adding non-breaking-spaces [ ] next to the count, or by padding the right side of the post count div by a few pixels.

Reply

Lashundra December 29, 2004 at 9:17pm

I clicked on the link to get the copy to copy & paste into a text editor but it gave me page not found. Would you please email me the code at the email addy listed?

Thanks

Reply

JErm December 29, 2004 at 11:28pm

Sorry about that, I have the link fixed now! :)

Reply

Lashundra December 30, 2004 at 3:50am

thanks jerm for the code, hopefully i’ll be able to follow the simple instructions to make it work.

happy new years!

Reply

JErm December 30, 2004 at 11:25am

Good luck.. if you find any problems feel free to drop by again later! :)

Reply

Tracy April 8, 2005 at 10:15pm

I downloaded your plugin/hack and installed. It shows the number of posts in each category, BUT it takes away the link to each category…. the cat # is gone and link to nowhere…. any ideas?? also, is there a way to do it so the number of posts – the count – is in (23) brackets??

Reply

JErm April 8, 2005 at 11:03pm

Tracy, that plugin was made for 1.2 so I don’t know if it still works; apparently not.. hehe.. I’ll drop you an email if I get a chance to fix it for 1.5, and I’ll look into the brackets thing, but I think WP has that feature by default now.

Reply

Madolyn May 23, 2005 at 10:46pm

Please humour a complete idiot… I need to pass two arguments, so would the following be correct?

Reply

Madolyn May 23, 2005 at 10:47pm

Damn, let me ask that again…
<?php wp_list_cats(‘sort_column=name’,’optioncount=1′); ?>

Reply

JErm May 24, 2005 at 11:41am

Madolyn » I think so but you better check the WP Codex to make sure.

Reply

Leave a Comment