'', 'slug' => '', 'menu_class' => 'menu', 'format' => 'div'); $args = wp_parse_args($args, $defaults); $args = (object) $args; $menu = null; if ( !empty($args->id) ) { $menu = wp_get_nav_menu( $args->id ); } elseif ( !empty($args->slug) ) { $menu = get_term_by('slug', $args->slug, 'nav_menu'); } else { $menus = wp_get_nav_menus(); foreach ( $menus as $menu_maybe ) { if ( wp_get_nav_menu_items($menu_maybe->term_id) ) { $menu = $menu_maybe; break; } } } if ( !$menu || is_wp_error($menu) ) return wp_page_menu( $args ); if ( 'div' == $args->format ) echo '
'; } function wp_print_nav_menu( $args = array() ) { // Defaults $defaults = array( 'type' => 'frontend', 'name' => 'Menu 1', 'id' => 0, 'desc' => 2, 'before_title' => '', 'after_title' => ''); $args = wp_parse_args($args, $defaults); extract($args, EXTR_SKIP); $menu_items = wp_get_nav_menu_items( $id ); $parent_stack = array(); $current_parent = 0; $parent_menu_order = array(); // Setup parentage foreach ( $menu_items as $menu_item ) { $parent_menu_order[ $menu_item->ID ] = $menu_item->menu_order; } // Display Loop foreach ( $menu_items as $key => $menu_item ) { $menu_item = wp_setup_nav_menu_item($menu_item); // List Items ?>