if ( is_string( $args->container
) &&
in_array( $args->container,
$allowed_tags, true
) ) { $show_container = true;
$class =
$args->container_class ? ' class="' .
esc_attr( $args->container_class
) . '"' : ' class="menu-' .
$menu->slug . '-container"';
$id =
$args->container_id ? ' id="' .
esc_attr( $args->container_id
) . '"' : '';
$aria_label =
( 'nav' ===
$args->container &&
$args->container_aria_label
) ? ' aria-label="' .
esc_attr( $args->container_aria_label
) . '"' : '';
$nav_menu .= '<' .
$args->container .
$id .
$class .
$aria_label . '>';
} } // Set up the $menu_item variables.
_wp_menu_item_classes_by_context( $menu_items );
$sorted_menu_items = array
();
$menu_items_with_children = array
();
foreach ( (array) $menu_items as $menu_item ) { /*
* Fix invalid `menu_item_parent`. See: https://core.trac.wordpress.org/ticket/56926.
* Compare as strings. Plugins may change the ID to a string.
*/
if ( (string) $menu_item->ID ===
(string) $menu_item->menu_item_parent
) { $menu_item->menu_item_parent = 0;
}