/** * Traverse elements to create list from elements. * * @see Walker::start_el() * @since 2.5.0 * * @param object $element Data object * @param array $children_elements List of elements to continue traversing. * @param int $max_depth Max depth to traverse. * @param int $depth Depth of current element. * @param array $args * @param string $output Passed by reference. Used to append additional content. * @return null Null on failure with no changes to parameters. */ public function display_element($element, &$children_elements, $max_depth, $depth, $args, &$output) { if (!$element) { return; } //If parent is not current item, don't output children if (!$element->current) { parent::unset_children($element, $children_elements); } parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output); }