hasChildren = isset($children_elements[$element->ID]) && !empty($children_elements[$element->ID]); return parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output); } /** * @param string $output Passed by reference. Used to append additional content. * @param int $depth Depth of page. Used for padding. */ function start_lvl(&$output, $depth = 0, $args = array()) { $indent = str_repeat("\t", $depth); $output .= "\n$indent
\n"; } /** * @param string $output Passed by reference. Used to append additional content. * @param object $item Menu item data object. * @param int $depth Depth of menu item. Used for padding. * @param int $current_page Menu item ID. * @param object $args */ function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) { $indent = ($depth) ? str_repeat("\t", $depth) : ''; $class_names = ''; $classes = empty($item->classes) ? array() : (array) $item->classes; $classes[] = 'menu-item-' . $item->ID; $active = array_search('current-menu-item', $classes); $ancestor = array_search('current-menu-ancestor', $classes); if (false !== $active) $classes[$active] = 'active'; if (false !== $ancestor) $classes[$ancestor] = 'active'; if ($item->hasChildren && 0 == $depth) $classes[] = 'dropdown'; $class_names = join(' ', $classes); $class_names = $class_names ? ' class="' . esc_attr($class_names) . '"' : ''; $data_toggle = ($item->hasChildren && 0 == $depth) ? ' data-toggle="dropdown"' : ''; $id = $id ? ' id="' . esc_attr($item->id) . '"' : ''; $output .= $indent . '