Title: Post Count Alignment Problem
Last modified: August 19, 2016

---

# Post Count Alignment Problem

 *  Resolved [erniegarcia](https://wordpress.org/support/users/erniegarcia/)
 * (@erniegarcia)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/post-count-alignment-problem/)
 * My AVH Extended Categories Widgets are not displaying the post count inline, 
   instead the post count appears on the line below.
 * Is there anyone here that knows how to fix this?
 * My website:
    [http://tinyurl.com/682k3tc](http://tinyurl.com/682k3tc)
 * WordPress Theme:
    Habitat

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

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/post-count-alignment-problem/#post-1924757)
 * this is cause by a `display: block;` format on the links, while the numbers are
   ourside the linked text.
 * for the standard category widget, adding some code like this to functions.php
   of the theme works:
 *     ```
       add_filter('wp_list_categories', 'cat_count_inline');
       function cat_count_inline($links) {
       $links = str_replace('</a> (', ' (', $links);
       $links = str_replace(')', ')</a>', $links);
       return $links;
       }
       ```
   
 * you probably need to check if your plugin uses a similar filter hook.
 *  Thread Starter [erniegarcia](https://wordpress.org/support/users/erniegarcia/)
 * (@erniegarcia)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/post-count-alignment-problem/#post-1924808)
 * Hi alchymyth,
 * A week ago you helped me fix the post count problem for my standard category 
   and archive widget. You suggested I insert the following code below and it corrected
   the issue.
 * _[Code moderated as per the [Forum Rules](http://codex.wordpress.org/Forum_Welcome).
   Please use the [pastebin](http://wordpress.pastebin.com/)]_
 * I can’t for the life of me however fix the same post count issue for my AVH Extended
   Categories Widgets. My coding skills are really weak, so I’m totally stumped 
   as to what step to do next. The author of the wp theme that I’m using suggested
   I use a string replace function, but I don’t know how to construct/write one 
   of those.
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/post-count-alignment-problem/#post-1924862)
 * the plugin widget seems to add an extra div to the cat count, which needs a different
   filter:
 * try to add this to functions.php of your theme:
 *     ```
       add_filter('wp_list_categories', 'avh_cat_count_inline');
       function avh_cat_count_inline($links) {
       $links = str_replace('</a><div class="avhec-widget-count"> (', '<div class="avhec-widget-count"> (', $links);
       $links = str_replace(')', ')</a>', $links);
       return $links;
       }
       ```
   
 *  Thread Starter [erniegarcia](https://wordpress.org/support/users/erniegarcia/)
 * (@erniegarcia)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/post-count-alignment-problem/#post-1924876)
 * This perfectly corrected the issue in Opera 10.63, however there are still some
   display errors in IE, FireFox, and Chrome.
 * In FireFox 3.6.13 and Chrome 9, it placed the post count on a new line, complete
   with a line arrow.
 * In IE 8 it’s almost totally fixed, however the second line for each widget has
   too much top line padding [+4px].
 * Screenshots:
 * IE8: [http://tinyurl.com/6zp4uzv](http://tinyurl.com/6zp4uzv)
    FireFox: [http://tinyurl.com/6l59ca5](http://tinyurl.com/6l59ca5)
   Chrome: [http://tinyurl.com/6xa5f5r](http://tinyurl.com/6xa5f5r)
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/post-count-alignment-problem/#post-1924886)
 * i see.
    try this:
 *     ```
       add_filter('wp_list_categories', 'avh_cat_count_inline');
       function avh_cat_count_inline($links) {
       $links = str_replace('</a><div class="avhec-widget-count"> (', '<span class="avhec-widget-count"> (', $links);
       $links = str_replace(')</div>', ')</span></a>', $links);
       return $links;
       }
       ```
   
 * this changes the div into a span (for valid html code), and takes care for the
   closing element as well (which i forgot before)
 * and because you don’t use the normal category widget, make sure you don’t have
   this at the same time (remove this from functons.php, otherwise it will interfere):
 *     ```
       add_filter('wp_list_categories', 'cat_count_inline');
       function cat_count_inline($links) {
       $links = str_replace('</a> (', ' (', $links);
       $links = str_replace(')', ')</a>', $links);
       return $links;
       }
       ```
   
 *  Thread Starter [erniegarcia](https://wordpress.org/support/users/erniegarcia/)
 * (@erniegarcia)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/post-count-alignment-problem/#post-1924894)
 * Awesome, that fixed it! Thank you so much alchymyth, I really appreciate all 
   of your help.
 *  [koii123](https://wordpress.org/support/users/koii123/)
 * (@koii123)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/post-count-alignment-problem/#post-1925040)
 * it works , thanks

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

The topic ‘Post Count Alignment Problem’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 7 replies
 * 3 participants
 * Last reply from: [koii123](https://wordpress.org/support/users/koii123/)
 * Last activity: [15 years, 1 month ago](https://wordpress.org/support/topic/post-count-alignment-problem/#post-1925040)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
