WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] <?php the_category(',' ); ?> without link? (5 posts)

  1. ThreeVisual
    Member
    Posted 5 years ago #

    Is there anyway I can strip the link from <?php the_category(',' ); ?>?

  2. billray
    Member
    Posted 5 years ago #

    <?php
    foreach((get_the_category()) as $category) {
        echo $category->cat_name . ' ';
    }
    ?>

    Discussed here. Does that work for you?

  3. ThreeVisual
    Member
    Posted 5 years ago #

    worked perfectly! thanks!

  4. ffs_aggro
    Member
    Posted 5 years ago #

    hi there, i searched for the same thing and this worked for me too... but am i able to show the category in which the post is only? without the parent category...

  5. nipponese
    Member
    Posted 5 years ago #

    This works great for stripping the link, but a cool feature in the_category() is being able to use a separating character that doesn't echo on the last cat. Is there a workaround to make get_the_category() work like this?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.