You can specify the style
argument as something other than the default (which is list
) and it won’t wrap the output in a <li>
. You can then wrap it in a <div>
yourself.
Combine it with the echo
argument if you need to check that the list isn’t empty. Example:
$args = array(
'taxonomy' => 'product_category',
'hide_empty' => 0,
'orderby' => 'name',
'order' => 'ASC',
'show_count' => 0,
'use_desc_for_title' => 0,
'title_li' => 0,
'style' => '',
'echo' => false,
);
$categories = wp_list_categories($args);
if ( $categories ) {
printf( '<div class="col">%s</div>', $categories );
}
Related Posts:
- Is There a Difference Between Taxonomies and Categories?
- Only one category per post
- Get rid of WordPress category, tag and author archives?
- Filtering categories in the permalink structure
- get_categories hierarchical order like wp_list_categories – with name, slug & link to edit cat
- wp_nav_menu not appearing for a couple pages
- Why aren’t sub-categories nested after creating post in the WP Admin?
- Preventing index.php?category_name=something from redirecting
- How to get category id of current post?
- Programmatically create product category and add thumbnail in woocommerce
- cat_is_ancestor_of() for custom taxonomies
- Category and tag with same name
- How to display parent category name and link for custom breadcrumb
- Exporting just posts of a specific category
- How to display only the parent category in the permalink
- How to add HTML5 ‘required’ attribute to wp_dropdown_categories() without JavaScripts?
- If a post has two categories with different permissions, what will happen? [closed]
- Dropdown category filter
- Filter out posts before display category count
- How to show in search results posts with a particular tag in a particular category?
- Category vs Tag vs Table
- How to find the number of Tags a post has?
- Multiple menu items highlighted
- Categories not working – 404 Not found error
- How to not treat categories as tags in feeds
- Add title, post content, and category like add_post_meta and update_post_meta
- wordpress wp_list_categories
- How to create button to direct to certain category
- Group listed elements by category
- Highlight wp_nav_menu when category is selected
- Get link which associated with a specific category and tag
- How to disable default category linkbuilding?
- How to assign posts without any category to the default category
- Show only first category name in RSS?
- Show parent category in URL of subcategory archive page
- Filter $cpt categories to omit certain category
- Yearly Archive for Categories with dropdown
- Display Posts Loop for each parent and for each Child
- get_categories listing foreach with children
- Removing subcategories from permalinks [duplicate]
- Different banner for different section
- How to query categories with Advanced Custom Fields?
- Undefined property: stdClass::$id when retriving term ID
- Wacky taxonomy in wordpress
- Link to the next/prev posts in index loop in same category?
- How to automatically check multiple categories on new post
- Output the text before category
- Change div background acording to the selected category
- get_the_categories() but exclude children of “Uncategorized”
- How to exclude a particular category from the category list
- Why title_li =” not working
- Hide specific category from wp_list_categories
- ow to display the number of posts in a category
- Custom Permalink with child categories creating 404
- Cannot filter categories by parent category
- Redirect year month day postname permalink structure to category postname structure
- Show all sub categories?
- Category nicename inside loop in wordpress
- Exclude all subcategories in the_category (post)
- Displaying another main nav menu for specific category
- Exclude categories from list (wp_list_categories)
- How to display the 5 latest post titles but allow only 1 in there of a specific category
- WordPress: Using the category slug get the category ID using mysql query
- Create a Category with a front-end post
- Posts made to category don’t show up (do show up on frontpage)
- Exclude category to “the_breadcrumb” functions
- Global navigation in multisite: problem with categories
- Migrate the posts of a category to another blog as a custom taxonomy
- Woocommerce only display child category when parent is checked (on add new product page)
- Add $args to wp_list_categories
- How to hide a category or tag everywhere EXCEPT for use with get_posts
- Show parent category wp_list_categories wordpress
- How to remove category name for only one category?
- Taxonomy custom check box meta field not getting saved
- Subcategories randomly not working after page/post/category edit in wordpress. Fix: saving permalinks twice
- In if…else condition, the else statement shows even if if statement is correct
- Restrict retrieved terms by category?
- Get category from slug list
- I just want to list ONLY the child categories, but not grandchildren
- Re-coding category-template.php to go to custom URL
- Category removal – Portfolio Category:
- How to Change Sort Order of default WordPress Catgory Widgets?
- Custom filters inside a specific category?
- Paginations in Category Page Leads to Sample Pages
- $args Orderby The number
- Most efficient way to have 1 template for parent, 1 template for child categories?
- Function to list posts from current post’s category fails in WP 3.8
- Multiple parent categories
- Custom fields setup when category selected filter subcategories
- Make three menus with three category levels
- Getting categories to change appropriately when using $cat = ‘ ‘;
- how to call the category of the post
- Category related -> excerpt, title and thumb in sidebar on article page
- How to have a category not show up in query post with page panigation?
- single category widget with conditional terms
- Remove the current item from a menu
- why is the delete option missing from just one category?
- Get all categories
- Show category post order ASC
- How to display all category images for single post in a page?