Not sure if you ever got the recognition you deserve, but this worked great, out of the box.
Can anyone help me modify it so that if there are no children, it echos nothing? I’m assume an elseif statement at the end, but I’m not yet strong enough in PHP to get the markup correct, though I am doing some trial and error.