WordPress.org

Make WordPress Core

Ticket #12844: wp-menu-template.patch

File wp-menu-template.patch, 1.1 KB (added by tosak, 4 years ago)
  • nav-menu-template.php

     
    9090 * @return mixed $output False if menu doesn't exists, else, returns the menu. 
    9191 **/ 
    9292function wp_get_nav_menu( $args = array() ) { 
    93         $defaults = array( 'menu' => '', 'menu_class' => 'menu', 'context' => 'frontend', 'depth' => 0, 
     93        $defaults = array( 'menu' => '', 'menu_id' => '', 'menu_class' => 'menu', 'context' => 'frontend', 'depth' => 0, 
    9494        'fallback_cb' => '', 'walker' => '', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', ); 
    9595 
    9696        $args = wp_parse_args( $args, $defaults ); 
     
    124124 
    125125        // CSS class 
    126126        $ul_class = $args->menu_class ? ' class="'. $args->menu_class .'"' : ''; 
    127         $nav_menu .= '<ul'. $ul_class .'>'; 
     127        $ul_id = $args->menu_id ? ' id="' . $args->menu_id . '"' : ''; 
     128        $nav_menu .= '<ul'. $ul_class . $ul_id .'>'; 
    128129 
    129130        // Allow plugins to hook into the menu to add their own <li>'s 
    130131        if ( 'frontend' == $args->context ) {