Title: Customizing Category Widget
Last modified: August 19, 2016

---

# Customizing Category Widget

 *  [maple1249](https://wordpress.org/support/users/maple1249/)
 * (@maple1249)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/customizing-category-widget/)
 * Hi all,
 * I’m developing my own theme, and in doing so, need to structure the category 
   sidebar widget like so:
 *     ```
       <ul>
       <li>
       <a>CATEGORY NAME<span>PostCountWithOUTParenthesis</span></a>
       </li>
       ...
       </ul>
       ```
   
 * And the default way it works is:
 *     ```
       <ul>
       <li>
       <a>CATEGORY NAME</a> (PostCount)
       </li>
       </ul>
       ```
   
 * I was wondering if anyone could help me out with this? Thank you – it’s greatly
   appreciated!

Viewing 1 replies (of 1 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/customizing-category-widget/#post-1616713)
 * try to add something like this to functions.php of your theme:
 *     ```
       add_filter('wp_list_categories', 'cat_count_span_inline');
       function cat_count_span_inline($output) {
       $output = str_replace('</a> (','<span> ',$output);
       $output = str_replace(')','</span></a> ',$output);
       return $output;
       }
       ```
   
 * [http://codex.wordpress.org/Plugin_API/Filter_Reference](http://codex.wordpress.org/Plugin_API/Filter_Reference)
   
   [http://codex.wordpress.org/Template_Tags/wp_list_categories](http://codex.wordpress.org/Template_Tags/wp_list_categories)
 * it will output your structure for all the `wp_list_categories()` in your theme,
   where ‘show post count’ is ticked.

Viewing 1 replies (of 1 total)

The topic ‘Customizing Category Widget’ is closed to new replies.

## Tags

 * [category](https://wordpress.org/support/topic-tag/category/)
 * [custom widgets](https://wordpress.org/support/topic-tag/custom-widgets/)
 * [widgets](https://wordpress.org/support/topic-tag/widgets/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 1 reply
 * 2 participants
 * Last reply from: [Michael](https://wordpress.org/support/users/alchymyth/)
 * Last activity: [15 years, 10 months ago](https://wordpress.org/support/topic/customizing-category-widget/#post-1616713)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
