Forums

How to display only one category using the_category()? (2 posts)

  1. Jusi
    Member
    Posted 2 years ago #

    Hi,

    Let's say I have a post that in the "Subcategory" category which is a child of "Main" category. Using the_category(' ', multiple, $post_id) in the loop I get something like:
    Main Subcategory Main

    Is there a way to only display child category that this post belongs to? I would like to have only Subcategory link, without the double "Main" stuff.

  2. MichaelH
    Volunteer
    Posted 2 years ago #

    According to the_category():

    the_category(' ', '', $post_id)

Topic Closed

This topic has been closed to new replies.

About this Topic