Displaying category children--but NOT grandchildren (2 posts)

  1. JuryDuty
    Posted 3 years ago #

    I'm having trouble displaying category children WITHOUT grandchildren.

    Here's the current code I'm fiddling with:

    $portfoliocat = of_get_option('of_portfolio_cat', 'no entry' );
    $categories = get_categories('child_of='.$portfoliocat.'');

    If I add a parameter to the second line, such as...

    $categories = get_categories('child_of='.$portfoliocat.'&exclude=6');

    ...then I can get it to exclude one grandchild at a time. But I'd much rather just have it exclude them all so I don't have to mess with the code each time a new child or grandchild is created.

    Is this possible?

  2. Michael
    Forum Moderator
    Posted 3 years ago #

    have a look at the 'parent' parameter:


Topic Closed

This topic has been closed to new replies.

About this Topic