WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. jimmiejo
    Member
    Posted 6 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:

    <?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.

  2. jimmiejo
    Member
    Posted 6 years ago #

    Found a solution in another thread:

    http://wordpress.org/support/topic/145388?replies=10

    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