Show number of posts in a category

Posted by on Jan 22, 2010 in Articles, How-To | 1 comment

Tonight I needed to figure out how to display the number of posts that were in a specific category.

This post on Getting the number of posts per category showed me how to do that.

This goes into your template where you want the number to appear:

<?php echo get_category_by_slug('category-slug')->category_count; ?>

Replace category-slug with the slug of your category.

One Comment

  1. Is it possible to do this with the category ID?

Leave a Reply

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