'', 'container' => 'div', 'container_class' => '', 'menu_class' => 'menu', 'echo' => true, 'fallback_cb' => 'wp_page_menu', 'before_link' => '', 'after_link' => '', 'before_title' => '', 'after_title' => '', ); $args = wp_parse_args( $args, $defaults ); $args = apply_filters( 'wp_nav_menu_args', $args ); $args = (object) $args; // Get the nav menu $menu = wp_get_nav_menu_object( $args->menu ); // If we couldn't find a menu based off the name, id or slug, // get the first menu that has items. if ( !$menu ) { $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 ) ) $args->menu = $menu->term_id; $nav_menu = ''; if ( 'div' == $args->container ) { $class = $args->container_class ? ' class="' . esc_attr($args->container_class) . '"' : ''; if ( is_nav_menu($menu) ) { $nav_menu .= '