Title: wp_list_cats flag
Last modified: August 18, 2016

---

# wp_list_cats flag

 *  [Sephiroth](https://wordpress.org/support/users/sephiroth/)
 * (@sephiroth)
 * [19 years, 10 months ago](https://wordpress.org/support/topic/wp_list_cats-flag/)
 * How about adding a flag for the wp_list_cats function so that if template designers
   need it, the postcounts could be drawn before the closing anchor tag. 🙂
 * Currently, I have a list item like this:
 * `<li><a href="http://localhost/main/category/web-design/xhtml/" title="View all
   posts filed under (X)HTML">(X)HTML</a> (1)
    </li>
 * Yes, I’m currently designing it on localhost, but I would appreciate it if I 
   could achieve something like this without hacking the source:
 * `<li><a href="http://localhost/main/category/web-design/xhtml/" title="View all
   posts filed under (X)HTML">(X)HTML (1)</a>
    </li>
 * Thank you.

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

 *  [Mark Jaquith](https://wordpress.org/support/users/markjaquith/)
 * (@markjaquith)
 * [19 years, 10 months ago](https://wordpress.org/support/topic/wp_list_cats-flag/#post-439532)
 * You can use the `list_cats` hook plus some regex to do that switcheroo in a filter.
   No core modification needed.
 * Untested, but something like this should work:
 * `
    function txfx_put_count_in_the_link($text) { return preg_replace('#</a> (([
   0-9]+))#', ' ($1)</a>', $text; }
 * add_filter('list_cats', 'txfx_put_count_in_the_link');
 *  Thread Starter [Sephiroth](https://wordpress.org/support/users/sephiroth/)
 * (@sephiroth)
 * [19 years, 10 months ago](https://wordpress.org/support/topic/wp_list_cats-flag/#post-439737)
 * Nope, that did not work. You caused a parse error, (which I fixed btw), but when
   I did have it running, the count was still outside the link. :/ Thanks for trying..
   I’m hoping to get a this option added as a feature. :/ Thanks anyways.

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

The topic ‘wp_list_cats flag’ is closed to new replies.

 * In: [Requests and Feedback](https://wordpress.org/support/forum/requests-and-feedback/)
 * 2 replies
 * 2 participants
 * Last reply from: [Sephiroth](https://wordpress.org/support/users/sephiroth/)
 * Last activity: [19 years, 10 months ago](https://wordpress.org/support/topic/wp_list_cats-flag/#post-439737)
 * Status: not a support question

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
