With the code below, I added a span tag + placed the category count inside the link.
add_filter('wp_list_categories', 'cat_count_span');
function cat_count_span($links) {
$links = str_replace('</a> (', '<span>', $links);
$links = str_replace(')', '</span></a>', $links);
return $links;
}
The problem I'm having... this modification will apply on all pages or widgets that uses wp_list_categories
. And I'd like to have the opposite effect.
The code should only apply inside my custom made category widget.
What do I need to change so it will work the way I'd like it to work?