you could use this snippet, and modify the output string accordingly.
$categories = get_the_category();
$separator=" ";
$output="";
if ( ! empty( $categories ) ) {
foreach( $categories as $category ) {
$output .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" alt="' . esc_attr( sprintf( __( 'View all posts in %s', 'textdomain' ), $category->name ) ) . '">' . esc_html( $category->name ) . '</a>' . $separator;
}
echo trim( $output, $separator );
}
Related Posts:
- Control term order on a per-post basis
- Display all posts from all categories with pagination
- is_category() function
- Changing Top Level Items into Radio Buttons in the Categories Meta Box?
- How to create a widgetized sidebar for every category dynamically?
- Display the deepest child category from Category X (in loop)
- Remove “Category Archives: title” at the top of a category page [duplicate]
- When using get_categories or similar, is it possible to filter results that contain certain Tags as well?
- Exclude subcategories from the url
- Category Alphabet List Broken
- WooCommerce – Display product child categories from specific parent
- Select category in custom query
- Removed slug from CPT, now How/where do I hook the filter to the taxonomy term archive pages link?
- Display empty taxonomy terms with get_terms()
- Show list of categories even if they have no posts
- Search by word, category, tag, author
- How can I show the subcategories content on the parent category page?
- How to control template resolution if both Author and Category filter in place?
- Resolved – category-slug.php not working after wordpress migration
- How to retain the values from dropdown category lists after wrong form submission?
- Format Brand value in Category view [closed]
- Get multidimensional array that reflects category hierarchy
- Single_cat_title() print the title before text
- Sort posts by post_type in category.php template
- Add Post Screen Keep Category structure
- Possible to make a subdirectory that loops through a single category?
- editing fonts of category links from the_category() funtion
- Display children of the category a post is assigned to
- Automatically adding categories and authors in custom menu?
- Second level subcategory
- how to define category loop last class in the third
- Checkboxes in the category list?
- Automatically exclude categories from metabox based on title
- Making the category & tag Description textarea bigger
- How to display post categories within the Latest Posts block?
- WordPress admin categories sort show is wrong
- Huge category CSV import does not work
- Needing a snippet for listing category specific tags
- Displaying Categories and Sub Categories
- How can I edit the ‘Most Used’ tab in the categories meta-box to show another custom taxonomy?
- Use Tag input metabox style for Categories
- WordPress URL Rewrite for dynamic and customized URL
- Does “show_option_all” in wp_list_categories do anything?
- redirecting from a general category page to another specific one
- Show matching categories in search page
- How to hide category name
- Keyword search in multiple categories
- Targeting Parent Category Pages
- How to do paging in the loop?
- query_posts not reading correct categories
- Displaying list of subcategories and not parent category
- Linking doctors posts to specific services for a medical practice
- how to nest specific category thumbnails inside different containers
- Eliminate word from $term->name
- Is there any way to check which wordpress categories was created by which user?
- Showing HTML if Post is In Certain Taxonomy Term
- Category view with contents of [gallery]s shown
- Can I prioritize post categories for choice for breadcrumb trail?
- How can I include custom category and tag base in template files?
- Category List with custom urls
- query_post problem
- Get a list of all links on a page?
- Load the last post of a category
- create function to call category name and slug
- Disable Category Taxonomy
- custom wp_list_categories in single.php
- How to make product image inherit from category image
- Is this process OK to replace URL structure?
- Is it possible to set up blog categories without changing permalink structure
- How to display categories image in loop homepage WordPress
- How can i echo next and previous custom category from a Taxonomy
- how to give different template to each subcategory from same parent category?
- No hierarchy in wp_list_categories with child of and depth
- How to check a category checkbox using JavaScript
- Add subcategories posts to the counts column at the admin’s categories list
- Need help to structure our a complex hierarchy
- global categories – Share specific categories in wordpress multisite
- WordPress update 4.7 – the 70.000+ news posts became “Uncategorized”
- How Can Hide Define Category in Post Contents?
- How to auto update post title and slug with category name when post status is updated
- get_posts – require all categories
- 404 error when i try to search by category or by tag
- Choosing different templates for categories
- Problem with wp_list_categories
- hierarchical taxonomy in permalinks? using same slug
- Display one post on category.php: Wrong featured image
- WordPress Numeric Pagination with Query String [duplicate]
- Changing Permalinks for Category Pages Only
- Taxonomy for custom post type not found
- date.php shows all posts. how to fix it?
- Get post by Category in custom template
- Ajax call activate after submit in edit-tags.php page
- How can I get this code to only output one link?
- Assign a category by user and customize the edit-tags.php?taxonomy=category page
- Sorting Woocommerce products by category and attributes
- How to get Woocomerce categories count
- show posts from some category and sort by advance custom field
- Open everything in new tab
- Custom EndPoint not working when strip child category in URL
- How to add custom prefix before category base for category page URL?