WordPress.org

Forums

turn category name into a hyperlink (3 posts)

  1. iceq
    Member
    Posted 3 years ago #

    Hi. I am using this to show category name, what should it be to be hyperlink to the category as well, not merely a raw text?

    <?php $cat_id = get_cat_id($featured_category); $category = get_cat_name($cat_id); echo $category; ?>
  2. alchymyth
    Forum Moderator
    Posted 3 years ago #

    <?php $cat_id = get_cat_id($featured_category); $category = get_cat_name($cat_id); echo '<a href="'.get_category_link($cat_id).'">'.$category.'</a>'; ?>

    http://codex.wordpress.org/Function_Reference/get_category_link

  3. iceq
    Member
    Posted 3 years ago #

    thanx mate .. much appreciated :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags