How to add extra class in main menu? I'm creating custom theme. I am struggling to create main menu with drop down. I created a menu with custom code:

 &lt;?php 
            $main_menu_tree = menu_tree(variable_get('menu_main_links_source', 'main-menu'));
            print drupal_render($main_menu_tree);
          ?&gt;


But it doesn't working as I want. I need to add class in that particular &lt;UL&gt; tags. How can I achieve that?

I tried to Hook custom function in templates file. But no luck. How to call custom function into view page?

Below are some more screenshots.

Main menu with correct:



Menu with Wrong:



How to call custom menu design in custom theme?
You can use Menu Attributes Module to add classes.


  This simple module allows you to specify some additional attributes
  for menu items such as id, name, class, style, and rel.


To custom code it, you can add class to menu links using hook_menu_link_alter . Try something like this:

$item['options']['attributes']['class'] = array('class-one' , 'class-two');