You can fill this in yourself, if you also override the display_element()
method in your custom walker (because this is the easiest place to access the child element array):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | class WPSE16818_Walker extends Walker_Nav_Menu { function display_element( $element, &$children_elements, $max_depth, $depth=0, $args, &$output ) { $id_field = $this->db_fields['id']; if ( is_object( $args[0] ) ) { $args[0]->has_children = ! empty( $children_elements[$element->$id_field] ); } return parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output ); } function start_el( &$output, $item, $depth, $args ) { if ( $args->has_children ) { // ... } } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.