I'd like to add a line of text to the archive page when people browse by category that says "There are X posts in this category". How do I find out how many posts are in a category?
I've looked through the forums, I've looked through the codex, to no avail. I know it's possible because the number shows up on the category admin panel, but I can't figure out how it's done.
there's a way to do it in the category links list (in the sidebar, or wherever you happen to have your categories listed out)... so that after the category title, a number in parenthesis shows up saying how many posts...
http://codex.wordpress.org/Template_Tags/wp_list_cats
you'd use something like this (but read the above link to determine exactly what you want):
<ul>
<?php wp_list_cats('sort_column=name&optioncount=1'); ?>
</ul>
It's the optioncount=1 that will give you the number...
Right, but displaying the entire list of categories unfortunately isn't an option in this case. I was kinda hoping there was some sort of hidden option for single_cat_title(), but that seems unlikely.
How do they do it in the category admin section?
I want display count only on child but on Main categories the count will gone. How to do that?
Hi daltonrooney,
I've just posted what may be a solution to your q.
http://wordpress.org/support/topic/12805?replies=5#post-424730
Have a good day,
hip