*sigh* I know that…. but then that ALL I get…. just the children.
Let me try to demonstrate. Currently I have this structure:
# General
* Site Updates
* Friday Five
* Rants / Soapboxes
* Baby Watch a€?04
# Writings / Scribblings
* Thoraka€?s Tome
* Poems
* Keavar History
* Short Stories
* Rogue Redemption
* Writing Notes
# Humor
# Uber Geekdom
I’ve got afew top level cats, some of which have sub cats. I no longer want to display it like that. When on the main page, I want to display this:
# General
# Writings / Scribblings
# Humor
# Uber Geekdom
Then when the user click on a cat that has sub cats, say “General” then I want this to be displayed when the page reloads:
# General
* Site Updates
* Friday Five
* Rants / Soapboxes
* Baby Watch a€?04
# Writings / Scribblings
# Humor
# Uber Geekdom
And so on…. if I use child_of=1 (the General ID) I get this:
* Site Updates
* Friday Five
* Rants / Soapboxes
* Baby Watch a€?04
NOT what I want. I’ve since come to realize that it’s not going to be possible this way. Soooooo I want to compromize. Leave the sidemenu as the default, showing only the top cats:
# General
# Writings / Scribblings
# Humor
# Uber Geekdom
Then to have a horizontal menu at the top that lists the sub cats
* Site Updates * Friday Five * Rants / Soapboxes * Baby Watch a€?04
So I used the wp_list_cats(“child_of=”.$cat); function call…..
And it works when I click on General or Writings/Scribblings…. but if I click Humor, which does not have any sub categories, I get the foreach error.
Which is why I wanted to find out if there was a has_child function that would tell me if the current category (presumably I’d pass in the cat ID) has child categories or not. Then based on that, I could determine if I need to call the wp_list_cats or not.
Hope that helps to clear things up a bit.
Tg