WordPress.org

Support

Support » How-To and Troubleshooting » How to get the category when in category (outside loop)

How to get the category when in category (outside loop)

  • Hi folks,

    My problem is :

    I have a category parent and child categories. I have parent category inspiration and child photography.

    So if I am here: domain.com/inspiration/graphic-design/

    and if I use <?php the_category(‘ \ ‘); ?> it lists the categories that are present in the first post. So if my first post have 3 categories it will list all of the 3 categories. For example, my post have categories such as graphic design/product design/inspiration. Since I am into category/inspiration I want that to be listed.

    If I list the single category it only list the child category, in this case graphic-design. If I am into domain.com/inspiration/ than it lists inspiration. This i okay, but I need when I am in graphic design to echo the inspiration / graphic design as a text/link.

    Thanks in advance,

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘How to get the category when in category (outside loop)’ is closed to new replies.