WordPress.org

Support

Support » Themes and Templates » [Resolved] Include category links when using get_the_category

[Resolved] Include category links when using get_the_category

  • 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[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.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Include category links when using get_the_category’ is closed to new replies.