Well, you wouldn’t need a walker for that, if it’s simply adding a data
attribute or something like that you could just use the items_wrap
parameter. View wp_nav_menu()
in Resources:
$items_wrap = '<div class="top-nav" mine="something">';
$items_wrap .= '<ul id="%1$s" mine="something2" class="nav %2$s">%3$s</ul>';
$items_wrap .= '</div>';
wp_nav_menu( array(
'container' => false,
'echo' => true,
'before' => '',
'after' => '',
'link_before' => '',
'link_after' => '',
'depth' => 0,
'theme_location' => 'topnav',
'items_wrap' => $items_wrap, // The Default is: '<ul id="%1$s" class="%2$s">%3$s</ul>'
'walker' => new description_walker()
) );
This is a more straight-froward way to do it than messing with a walker or something of the sort.