Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter soundandshape

    (@soundandshape)

    Thread Starter soundandshape

    (@soundandshape)

    a quick search of this forum reveals that others are trying to figure this one out, but with no resolution! can anyone help?

    I think I’m close– I just don’t know how to use the cat_is_ancestor_of(cat1, cat2) function properly. any tips?

    So far I’ve been fiddling around with something like this

    $category_ids = get_all_category_ids(); //puts array of category IDs into variable $category_ids
    foreach ($category_ids as $category) { //loop thru the array…
    if (cat_is_ancestor_of($category, 5)) { //determine which category IDs are children of category 5.
    [do some code;] // only if $category is a child of ID5
    }
    }

    this doesn’t work, but it illustrates what I’m trying to do. I’m hoping I just need the correct syntax. how do I write this properly?

    btw, I found this from Otto.
    https://www.tibbles.net/designs/?p=25
    It seems like it’s along the same lines. Does it spark any ideas from anyone?

    any help would be appreciated!

    I am also trying to figure out how to generate a list of IDs dynamically.

    Instead of hardcoding the IDs into the page template, I need code that will dynamically return an array of the IDs of categories that are currently children of a certain parent category.

    something like get_category_IDs(child_of=’ParentID’)?

    If you figure this one out, please let me know!

    c.

Viewing 3 replies - 1 through 3 (of 3 total)