Support » Themes and Templates » Remove link to category archive in posts, but keep the text

Viewing 4 replies - 1 through 4 (of 4 total)
  • moshu

    (@moshu)

    It seems you missed this while searching for an answer:
    http://codex.wordpress.org/Template_Tags/get_the_category

    richardhenry

    (@richardhenry)

    So I did, very sorry. Thanks for your reply!

    richardhenry

    (@richardhenry)

    P.S. For anyone who can’t be bothered reading all that, simply insert:

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

    …anywhere in The Loop to display the category of the current post.

    godofcomics

    (@godofcomics)

    I needed the Category ID only, in text form [non-link]. So, if that is what you are also looking for, here is the code I found and tested: [it works].

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

    It displays only the cat id (number) instead of the name.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Remove link to category archive in posts, but keep the text’ is closed to new replies.