How to get rid of auto generated classes in secondary menu links and add my own classes I have taken the standard code for secondary menu from a Drupal 7 theme:

 &lt;?php if ($secondary_menu): ?&gt;
            &lt;?php print $search_form; ?&gt;
          &lt;?php endif; ?&gt;
    &lt;?php if ($search_form): ?&gt;
        &lt;?php print theme('links__system_secondary_menu', array(
          'links' =&gt; $secondary_menu,
          'attributes' =&gt; array(
            'id' =&gt; 'secondary-menu-links',
            'class' =&gt; array('menu', 'nav', 'navbar-nav'),
              ),
              'heading' =&gt; array(
                'text' =&gt; t('secondary'),
                'level' =&gt; 'h2',
                'class' =&gt; array('element-invisible'),
                  ),
                    )); ?&gt;
                  &lt;?php endif; ?&gt;


Now the ht,l output generates some autogen css witch i whant to get rit of and replace with my own classes?

&lt;h2 class="element-invisible"&gt;secondary&lt;/h2&gt;

&lt;ul id="secondary-menu-links" class="menu nav navbar-nav"&gt;
&lt;li class="menu-3 first"&gt;&lt;a href="/user"&gt;My account&lt;/a&gt;&lt;/li&gt;
&lt;li class="menu-15 last"&gt;&lt;a href="/user/logout"&gt;Log out&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;                                  
&lt;/div&gt;


How to delete menu-3 and menu-15 as well as all classes following when we add more links and add some custom links to work with stuff like font awesome?
You can use this preprocess hook to modify the menu classes.

For example, modify the output of the secondary menu links like this.

function YOURTHEME_links__system_secondary_menu(&amp;$variables)
{
   $output = "";

   foreach ($variables['links'] as $item =&gt; $link) {
      $classes = array('class1', 'class2');
      $output .= sprintf('&lt;li class="%s"&gt;%s&lt;/li&gt;', implode(' ', $classes), l($link['title'], $link['href']));
   }

   return $output;
}