How to add class only to top level ul in main menu I am new to drupal theming.I want to add class only to top level ul in main menu.Using theme_menu__tree_main_menu() affect all the ul tag.I found this for adding class only to top level..https://www.drupal.org/node/988694
function THEMENAME_menu_tree__menu_top_menu($variables) {
 return '' . $variables['tree'] . '';
}
But it didn't work.Doesn't adding any class.Am I missing something?Please Suggest Me!!Thank
That example is missing some code.  Those two empty strings should not be empty.  

There is a link on that page just above the code example to api documentation of theme_menu_tree() https://api.drupal.org/api/drupal/includes%21menu.inc/function/theme_menu_tree/7.x

On the api documentation page you can see it done correctly:

return '&lt;ul class="menu"&gt;' . $variables['tree'] . '&lt;/ul&gt;';