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;
Related Posts:
- How to create an automatic MultiColoumn MegaMenu with Categories WordPress
- How To Find Out WordPress Category Table in MYSQL?
- Main menu not appearing on category pages
- Multisite blog converting categories to subdomains
- Using URL parameters, list posts from category and custom taxonomy
- Display posts links from a category group by year
- List categories for author: list_categories function inside list_authors function
- How to Make a Categories Meta Box with Hierarchical Checkboxes on Frontend?
- Hide a certain category name without removing it?
- strip last comma from get_the_category
- How to? Redirect /category/sci-fi/ to /category/scifi/?
- Exclude a category from the filed under list only on some templates
- How to show empty category in admin menus search
- Categories and Tags returning 404 on the sidebar when using ugly permalinks
- has_category() for parent category
- Getting the sub category
- How to insert category and subcategory using ‘wp_insert_post’ function?
- Show posts of category in a page
- How to create taxonomy values for pages and list them in wp-admin
- display woocommerce all category title on home page
- When to use ‘get_category_by_path’ vs. ‘get_term_by’ to get category object from `get_query_var( ‘category_name’ )`?
- One WP install, I need to map a custom domain name to each category
- Show thumbnail for category?
- get_the_category_list() does not give me all my categories
- How to disable category without deleting?
- How to get category name from URL and pass to a template
- Displaying multiple loops based off of category
- Display Categories, Sub-categories, and Sub-sub-categories on separate pages
- WooCommerce IF statements not working
- Limit number of terms that a custom taxonomy can save per custom post type
- Category pie diagram meta box in post editing page
- There any way to get de percentage of number of post by user and category?
- query cat orderby and order not working
- Multiple URL’s based on category for one post
- WordPress category check
- Exclude current post from loop
- Removing Uncategorized on post save if other category present?
- Exclude categories from wp_list_categories by category slug
- Can’t delete a category in WordPress
- WordPress Categories in data-groups
- Get Categories Where Taxonomy Equals ‘n’
- Not showing list if there aren’t any categories to display
- How to list all categories and their IDs using SQL query?
- How to access deleted term inside delete_product_cat action
- How to order get_categories() in the same order as the menu?
- Remove Archive | from Categories
- Showing Categories for Page Edit – without plugin
- Difference between wp_list_categories and get_categories
- Show different menu on each woocommerce category page
- How to let the user create a selection of categories via the backend
- Have posts that belong to multiple categories, exclude some categories from homepage
- Display subcategories selectbox on each category page
- Only first category!
- How could I write a get_categories_by_year() function?
- How to add icon over specific thumb
- add_settings_field (exclude categories->reading) wp_category_checklist
- Retrieve post tags from from main wp_query
- Listing Post Categories on Home Page
- Get posts in a subcategory of a chosen parent
- How can I only display links from a child category
- Category Template – Show Last Entry as Featured
- can I ‘combine’ categories as a menu item?
- List taxonomy terms assigned to a post in hierarchical view
- How to set the same base url for two different taxonomies?
- Hide category name but show posts
- Count how many posts have a specified tag AND category
- Show the parent taxonomy by creating shortcode in woocommerce?
- Parent Category and Subcategory default text generated with category
- Post List by category and under custom taxonomy
- How to create a table with counts of category combinations?
- Multiple if statements with else for get_the_category [closed]
- Balance Tags to the_content Words Length
- How to create template for children category?
- Using a template page parent breaks page
- Categories and Tags Conflict after Woocommerce Installation
- Setting category for post as default
- the_content() not showing full posts in category template
- Query post only from categories that have subcategories
- How to get the link of all categories
- Show parent category if there is no subcategory
- Add category links?
- foreach,having wp_query inside, breaks after showing one result
- Display a category name automatically using code in the functions.php file
- Removing categories, Comments etc from posts?
- Add html word before category
- Include Category Description in search result
- Problem importing categories and sub-categories
- how to ask if in two categorys inside if
- All post of child category not in top category
- How to add a tag above a category post that displays the category name in WordPress
- Woocommerce – Display product category of product in Orders page
- How to show video from wp option value?
- Changing Woocommerce categories programatically
- Add an Exclusive or featured tag line to article titles
- How to list out post category name and description in page
- Print child category slug nicename
- How to link ACF relationship field to the new Query block in Full Site Editing
- Order Categories by Character Count
- Images as Categories
- Replace category titles inside RSS feed