Forums

Display child category name (1 post)

  1. chavo
    Member
    Posted 2 years ago #

    Hello. I was taking a look around this issue but I can't find a solution.

    I have a post in multiple categories...supose three categories at same time.

    The first category have 5 child categories.

    I'm formatting the post to display the category name. That's easy. But I want to display only de category name of the child category of the first category.

    Example:
    My post is in the categories "Fruits (child category of Food)" / "Green" / "Delicious"

    But in my post format, I want to display only the child category name of Food

    So my post have to look like this:

    Fruits
    <?php the_title (); ?>
    <?php the_content(); ?>

    I want to exclude the others categories.

    Is this possible? The code I'm using for it's a little bit messy and I have to put manually the id category of each category that I want to exclude.

    Thanks in advance

    ps: sorry for my english.

Topic Closed

This topic has been closed to new replies.

About this Topic