Output a Menu with just needed classes for ul and li,. Nothing more Normally a drupal menu is being rendered like this:

&lt;ul class="menu"&gt;
&lt;li class="first leaf"&gt;&lt;a title="" href="xxx"&gt;xxx&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="active-trail active" title="" href="yyy"&gt;yyy&lt;/a&gt;&lt;/li&gt;
&lt;li class="last leaf"&gt;&lt;a title="" href="zzz"&gt;zzz&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


I want it to be rendered as for a particular menu:

&lt;ul class="side-menu"&gt;
&lt;li&gt;&lt;a href="xxx"&gt;xxx&lt;/a&gt;&lt;/li&gt;
&lt;li class="active"&gt;&lt;a href="yyy"&gt;yyy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="zzz"&gt;zzz&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


So I have the following in my template.php

function mymod_menu_tree__menu_about_us($variables) {
  return '&lt;ul class="side-menu"&gt;' . $variables['tree'] . '&lt;/ul&gt;';
}

function mymod_menu_link__menu_about_us(array $variables) {
  $element = $variables['element'];
  $sub_menu = '';
  if ($element['#below']) {
    $sub_menu = drupal_render($element['#below']);
  }
  $class = "";
  $classes_of_this_li = $element['#attributes']['class'];
  if (in_array($classes_of_this_li, 'active-trail')) {
    $class = 'active';
  }
  $output = l($element['#title'], $element['#href']);
  return '&lt;li class="' . $class . '"&gt;' . $output . $sub_menu . "&lt;/li&gt;\n";
}


The ul is rendered as i want it to be. But the active class for the li is never there. Something must be wrong with below part

if (in_array($classes_of_this_li, 'active-trail')) {
    $class = 'active';
  }


Any idea?
Try switching the parameters to in_array. in_array takes the needle first and the haystack (array) second.

Edit: unless that was a typo...

Edit

PHP Docs for in_array().


bool in_array ( mixed $needle , array $haystack [, bool $strict = FALSE ] )

  
  Searches haystack for needle using loose comparison unless strict is
  set.