By
09/04/2016   Comments Off on Alter the display of the post count number in WordPress categories

View all snippets

Drop this in your functions file. In the snippet below, I remove the default parentheses around post count numbers and replace them with span tags. This makes it easier for me to style.

add_filter('wp_list_categories', 'alter_span_cat_count_output');
  function alter_span_cat_count_output($links) {
  $links = str_replace('</a> (', '</a> <span>', $links);
  $links = str_replace(')', '</span>', $links);
  return $links;
}