WordPress.org

Ready to get started?Download WordPress

Forums

How to Show Category URL on post page? (2 posts)

  1. superman9xx
    Member
    Posted 2 years ago #

    Hi,

    I want to echo the category url. example: http://www.sitename.com/category

    I don't want to use the "the_category" codex. I would like to only output the url. Can someone please help me with this....

    thank you

  2. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    <?php
    foreach( get_the_category() as $cat ) echo get_category_link( $cat->term_id );
    ?>

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

    if you have more than one category in the post, you will need to add formatting, or line breaks, or....

Topic Closed

This topic has been closed to new replies.

About this Topic