Child Category IDs–So Close! please help
-
I feel like I’m close on this. I think I have all the pieces of the puzzle; I just don’t know the correct syntax. Someone please help me out.
I want to dynamically generate a list of category IDs of just the categories which are currently children of a certain parent category.
I found these functions which I think will help:
$category_ids = get_all_category_ids();
Returns an array containing IDs for all categories.cat_is_ancestor_of(cat1, cat2);
Returns true if cat1 is an ancestor of cat2.I’m thinking I want to loop thru the array of category ids generated by get_all_category_ids(), using cat_is_ancestor_of() to check to see which are children of “cat2” (the parent category). For the categories that are children of cat2, I want to [do some code].
Is this right? How do I write this?
- The topic ‘Child Category IDs–So Close! please help’ is closed to new replies.