• Resolved beans_etc

    (@beans_etc)


    I’d like to display simply the name of the category a post belongs to underneath the post title. But when I use <?php the_category(); ?> it automatically makes the name a link. Is there anyway to get rid of the <a href” it puts in so it displays as just text?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Check out the Category Template Tags.
    Template_Tags/#Category_tags

    Thread Starter beans_etc

    (@beans_etc)

    I did. There’s a similar one “single_cat_title”, but it only seems to work if you’re on the single page for the category itself. I need it to be able to display the name of the post category, not the current page category.

    I said check them ALL, not what you think it should be.
    Template_Tags/get_the_category

    And don’t ever double post, unless yu want your topics deleted!

    Thread Starter beans_etc

    (@beans_etc)

    I thought that one was only used for backend purposes because it says “This function does not display anything”. I’m not very php savvy, so I assumed that meant it couldn’t be used to show text.

    I’ll try this to see if it works, thanks~

    Thread Starter beans_etc

    (@beans_etc)

    (Apologies for the double post.)

    Don’t think, just read:

    The following example displays the category name of each category assigned to the post (this is like using the_category(), but without linking each category to the category view, and using spaces instead of commas):

    Thread Starter beans_etc

    (@beans_etc)

    Nice, I just put it the first example from that page as is and it worked! Thanks a lot for the help and clarification~

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Displaying category name without link’ is closed to new replies.