Main Menu Display Description as span Tag I modifed my main menu using the following code, but I need the &lt;span class="description"&gt; elements only for the first level menu items, not for the sub-menu items.

How can I achieve this?

function neofelis_menu_link(array $variables) {
  $element = $variables['element'];
  $sub_menu = '';
  $element['#localized_options']['html'] = TRUE;


  if ($element['#below']) {
    $sub_menu = drupal_render($element['#below']);
  }

  if ($element['#original_link']['menu_name'] == "main-menu" &amp;&amp; isset($element['#localized_options']['attributes']['title'])){
    $element['#title'] .= '&lt;span class="description"&gt;' . $element['#localized_options']['attributes']['title'] . '&lt;/span&gt;';
  }

  $output = l($element['#title'], $element['#href'], $element['#localized_options']);
  return '&lt;li' . drupal_attributes($element['#attributes']) . '&gt;' . $output . $sub_menu . "&lt;/li&gt;\n";
}
Looks like your friend is: $element['#original_link']['depth'];

You would adjust your conditional to be something like:

 // Not sure if top level depth is 0 or 1 for this so experiment with that a bit.
 if ($element['#original_link']['menu_name'] == "main-menu" &amp;&amp; 
     isset($element['#localized_options']['attributes']['title']) &amp;&amp;
     $element['#original_link']['depth'] == 0
 ){
    $element['#title'] .= '&lt;span class="description"&gt;' . $element['#localized_options']['attributes']['title'] . '&lt;/span&gt;';
 }


Check out this comment from the drupal documentation.