List main category, and only 1 level of sub categories (2 posts)

  1. jabbamonkey
    Posted 3 years ago #

    I've been looking around for how to do this, and there seems to be a ton of example on parents and children, but I can't find one that does what I need.

    So, I have categories like...


    If the user is on a top level category page (such as /category/food/) OR if the user is on a sub page (either category/food/recipes/italian or just /category/food/recipes/), then I need to...

      Print the parent category name and link to it.
      List only the first level sub categories.

    So, if the user was on any food page (or sub category page), they would see the menu...

    [link to food page]Food[/]

    See below for where I am at... not really working and I'm sure my code needs to be cleaned up alot ... So far, if I go to the top level page (i.e. /food/), it prints the ENTIRE list of categories and children. On the subcategory pages (i.e. /food/recipes/ or food/recipes/mexican/) it doesn't show anything.

    [code moderated - please use the pastebin]

  2. Nazmul Ahsan
    Posted 3 years ago #

    I have same problem. Anyone please help..

Topic Closed

This topic has been closed to new replies.

About this Topic