WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Show only the subcategory of a post (3 posts)

  1. fodden
    Member
    Posted 7 years ago #

    Can anyone tell me how to show only the subcategory of a post? I can use the_category to get me both the category and its child, of course. But I can't find a way to show only the child. (I'm doing this because the page on which the posts appear is a category page, so the parent is obvious.)

    I have searched through the codex and the support forum but haven't found anything quite on point.

    Any help would be greatly appreciated.

    Cheers,

    Simon

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    By default, the_category() doesn't show parents of child categories, unless the post is assigned to the parent category as well.

    Take the parent category off the post and it won't show that parent as part of the_category() anymore.

  3. fodden
    Member
    Posted 7 years ago #

    Otto42 thanks a million. So easy and simple --- when you know.

Topic Closed

This topic has been closed to new replies.

About this Topic