You can use the_category if you are in the loop:
<?php the_category(', '); ?>
If not, then use this code:
<?php
$output="";
foreach((get_the_category()) as $category) {
if($category->name==$homecat) continue;
$category_id = get_cat_ID( $category->cat_name );
$category_link = get_category_link( $category_id );
if(!empty($output))
$output .= ', ';
$output .= '<span class="cat"><a href="'.$category_link.'">'.$category->cat_name.'</a></span>';
}
echo $output;
?>
Related Posts:
- How to display non-hierarchical taxonomy as terms with checkboxes?
- Make parent categories not selectable
- Reflect nested categories in appearance > menus
- How to show posts of an columnized different categories on the same line or row?
- Echo one category as title when post has multiple categories?
- How to Override default update_count_callback for category
- I use same slug name for category and page
- On Category page, How can I get the category ID?
- Order Taxonomy Term by date created
- How do I display the posts from a custom post type on a category.php page?
- Let visitors post comments on category page
- category_description() shows raw html after version 3.x?
- Add Icons to the Product Category Sidebar Widget WooCommerce
- Add class to items in wp_list_categories()
- How is the single category page called and how does it know which posts to show?
- How to export/import categories and keep their IDs?
- Is it possible to select and edit the way the most recent post from a certain category is displayed on the page?
- How to link 2 categories (Sync)
- How to make a Thumbnails Mosaic
- wp_parse_args & category parameter
- Extract image url associated to a category
- Change existing taxonomy settings when using custom taxonomy
- Enter a variable in the ‘category_name’ parameter
- How do you categorize pages?
- List Sub-Categories of a Parent Category
- add text to the top of category page
- If statement for catergories
- Rewrite a category
- Query posts from category based on a filter most favorited
- How do I call posts with a certain tag?
- Order of subcategories
- “Categories” for six authors [closed]
- WordPress/Woocommerce only show category in shop to a single role
- How to create a page which lists all categories with its ratings [closed]
- Category control subcategories
- display posts from specific category on a page , in thematic child theme?
- Latest comments from each category?
- custom post type category link redirects to index
- Categorie parents and childs displayed
- Can Categories be used to hack a Multisite-like setup w/ a single MySql db?
- Why do I have stray bullet from
- Display random categories
- Custom loop of a single category, cannot order by date. What am I missing?
- Get URL Category Name By ID
- Link To Child Category For A Post
- List a maximum of ‘x’ product categories with qty of ‘y’ in each column
- Post by category+author not working!
- Custom template for sub-sub-categories
- Show parent categories and sub categories but not grand children categories
- How can i change what one category displays?
- How do I change the category permalink structure?
- How to remove the tilte “category:category name”?
- How to display post in custom file not in archive file?
- Why is my sub-category template showing the wrong posts
- why category__and and category__in wont work togather?
- Natural sort / ordering wp_dropdown_categories
- Best way to categorize/populate a magazine style layout
- Mass Update User Profile Checkbox Options
- Category sticky latest
- Setting the Primary Category for a Post Based on Context
- Show the number of the post
- Automatically adding tags and categories into Post Excerpt for searching
- How to list posts from a sub-category that is listed in a parent category (more details below)?
- Allow Custom Role to edit a custom post type category
- How to check parent & child category
- Shop Category Pages missing s
- How to prevent tag “iframe” from being deleted from the heading description of rubric?
- When creating a new product, auto assign it to all custom taxonomy woocommerce
- How do I merge WooCommerce categories with the same name?
- Custom get_the_password_form
- How can I make a category function as a page?
- How to add custom option to wp_dropdown_categories?
- How to hide/remove featured images in particular categories post?
- In ACF, how to show custom category selection tab upon selecting a main category
- WooCommerce – Get products from category right before deleting category
- Create duplicate category page with content variations
- Renaming default category taxonomy?
- Profiling user with categories
- Category names dependent on each other?
- How to relocate images
- Hide category name in URL
- Category archives
- Category For Pages In WordPress
- Inserting categories as a hierarchical terms from frontend form
- Backend – Categories and Menus conflicts
- category__and works, but why?
- Highlight posts that belong to current sub category
- How to add an empty entry to masonry?
- Own Custom Tags/Category page ( posts)
- How to display many photo albums related to category
- Modify functions.php to add a term ‘uses-theme’ set to theme name on post save
- Create custom Perma link
- Display post of current parent category, and in right hand side show child category post
- Add product category to post_class
- Moving Blog and Changing URL
- completely confused with archive.php, category.php
- How to get specific number of category post on a page or category page?
- Use same wordpress category base and tags as the prefix as the post permalink
- Display different sidebar based on search results from one category
- Adding category to existing post (uploaded file)