Adding class to nested UL in menu I'm creating my menu using view along with Bootstrap to create a mega menu style navigation.
I'm having a problem with the nav showing expanded at times when you come to the site and or refresh. not all the time but more than I'd like.
I am using: _menu_link like such:
function MYTHEME_menu_link(array $vars) {
  if ( $vars['element']['#theme'] == 'menu_link__user_menu' ) {
    $vars['element']['#attributes']['class'][] = '';
  }
  elseif ( $vars['element']['#theme'] == 'menu_link__main_menu' ) {
    $vars['element']['#attributes']['class'][] = 'dropdown mm-menu-fw';
    $vars['element']['#localized_options']['attributes']['class'][] = 'url-link';
  }
  return theme_menu_link($vars);
}

This gives me the following HTML markup.
&lt;ul class=&quot;dropdown mm-menu-fw&quot;&gt;
  &lt;li&gt;
    &lt;a href=&quot;#&quot; class=&quot;url-link&quot;&gt;MY LINK&lt;/a&gt;
    &lt;ul class=&quot;NEED-TO-ADD-CLASS&quot;&gt;&lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;
You might get into the sub menu element with the ['#below'] object. not tested.

&lt;?php

   /**
    * Implements theme_menu_link__[MENU NAME].
    */
   function YOURTHEME_menu_link__main_menu(&amp;$variables) {       


        $element = $variables['element'];
        $sub_menu = '';         

        $element['#attributes']['class'][] = 'dropdown mm-menu-fw';        
        $element['#localized_options']['attributes']['class'][] = 'url-link';

        if ($element['#below']) 
        {
         $sub_menu = $element['#below']['#attributes']['class'][]= 'NEED-TO-ADD-CLASS';
         drupal_render($sub_menu);
        }

       $output = l($element['#title'], $element['#href'], $element['#localized_options']);

       return '&lt;li' . drupal_attributes($element['#attributes']) . '&gt;' . $output . $sub_menu . "&lt;/li&gt;\n";

 }
?&gt;