I’m using a snipet from the Codex to display only one category name. It hides additional category names for posts that have more than one. That code is:
<?php $category = get_the_category(); echo $category->cat_name; ?>
It works like a charm, but uses get_the_category, which just displays the name without an href. How would I go about including the category link for the one name displayed?
OR, is there a way to include category links with wp_list_categories, as that would allow me to easily exclude the handful of category names I never want to display, instead of using the code above to only show one.
- The topic ‘Include category links when using get_the_category’ is closed to new replies.