[resolved] Include category links when using get_the_category (2 posts)

  1. jimmiejo
    Posted 8 years ago #

    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:

    $category = get_the_category();
    echo $category[0]->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.

  2. jimmiejo
    Posted 8 years ago #

    Found a solution in another thread:


    Might be handy for someone else looking to do the same. Topic resolved.

Topic Closed

This topic has been closed to new replies.

About this Topic