Title: Adding category count
Last modified: August 15, 2024

---

# Adding category count

 *  Resolved [readysite](https://wordpress.org/support/users/readysite/)
 * (@readysite)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/adding-category-count-3/)
 * How could I add the number of posts for each category (in parenthesis)? thanks

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [Eduard](https://wordpress.org/support/users/cteduard/)
 * (@cteduard)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/adding-category-count-3/#post-17954968)
 * Hello [@readysite](https://wordpress.org/support/users/readysite/)
 * I’m sorry, but I do not know what you’re referring to here. Where are you trying
   to add these numbers, specifically?
 * Can you please provide a detailed description of what you’re trying to do? I 
   may be able to point you in the right direction. 🙂
 * Thanks.
 *  Thread Starter [readysite](https://wordpress.org/support/users/readysite/)
 * (@readysite)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/adding-category-count-3/#post-17954981)
 * in the category name h1 at the end, and in the page title
 * I want to display the number of posts in a category
 * I found this code on the forum and I can’t adjust it to the theme:
 * function custom_add_count_on_archive_title( $title ) { $term = get_queried_object();
   if( $term instanceof WP_Term && ‘category’ === $term->taxonomy ) { $title .= ‘(‘.
   $term->count.’)’; } return $title; } add_filter( ‘get_the_archive_title’, ‘custom_add_count_on_archive_title’,
   10, 1 );
 *  [Eduard](https://wordpress.org/support/users/cteduard/)
 * (@cteduard)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/adding-category-count-3/#post-17956479)
 * Hello [@readysite](https://wordpress.org/support/users/readysite/)
 * From what we can see, you have added the wrong priority to that snippet of code.
   It should be 20 instead of 10, something like this –
 *     ```wp-block-code
       function custom_add_count_on_archive_title( $title ) {	$term = get_queried_object();		if( $term instanceof WP_Term && 'category' === $term->taxonomy ) {		$title .= ' ('.$term->count. ') '; 	} 		return $title;}	add_filter( 'get_the_archive_title', 'custom_add_count_on_archive_title', 20, 1 );
       ```
   
 * One important thing to note here is that in the future, we will not be able to
   provide support for custom code as this is something that’s not directly related
   to the theme. If you require such assistance, we recommend contacting a knowledgeable
   developer. 🙂
 * Hope this helps!
 * Thanks.
 *  Thread Starter [readysite](https://wordpress.org/support/users/readysite/)
 * (@readysite)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/adding-category-count-3/#post-17956533)
 * it worked! thanks, you are the best
 *  [Eduard](https://wordpress.org/support/users/cteduard/)
 * (@cteduard)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/adding-category-count-3/#post-17956628)
 * You are welcome, [@readysite](https://wordpress.org/support/users/readysite/)
   🙂 🙇‍♂️

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Adding category count’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/blocksy/2.1.44/screenshot.jpg)
 * Blocksy
 * [Support Threads](https://wordpress.org/support/theme/blocksy/)
 * [Active Topics](https://wordpress.org/support/theme/blocksy/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/blocksy/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/blocksy/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Eduard](https://wordpress.org/support/users/cteduard/)
 * Last activity: [1 year, 9 months ago](https://wordpress.org/support/topic/adding-category-count-3/#post-17956628)
 * Status: resolved