WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to add category link to its name (4 posts)

  1. gunshuter
    Member
    Posted 6 months ago #

    Hi there !
    I have this code
    <?php
    foreach((get_the_category()) as $category) {
    echo $category->cat_name . ' ';
    }
    ?>
    which displays the category name if I put it in single.php
    what I want is not just to get the name but the url of the category so I am wondering about how to do that
    Regards

  2. esmi
    Forum Moderator
    Posted 6 months ago #

  3. gunshuter
    Member
    Posted 6 months ago #

    I have Read that page but still whenever I to put the link code I get an error
    --> what I am trying to do is show the name of the category under each post content
    so I used this one and put it in single.php
    it worked fine and showed me only the name not linked to the category page
    what I want is to make the category name that shows under the post linked to the category page

  4. gunshuter
    Member
    Posted 6 months ago #

    sorry found it in that page that you gave me
    thanks a lot for helping me out :)

Reply

You must log in to post.

About this Topic