Wrap Post count in a span

adding a filter to functions.php of your theme is one possibility:

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

this would add the spans to any occurrence of ‘wp_list_categories()’ site wide.

or change your code into:

$args = array(                 
  'hide_empty' => FALSE,                 
  'title_li'=> __( '' ),                 
  'show_count'=> 1,             
  'echo' => 0
);             
  $links = wp_list_categories($args);
  $links = str_replace('</a> (', '</a> <span>(', $links);
  $links = str_replace(')', ')</span>', $links);
echo $links;

Leave a Comment