I modifed my main menu using the following code, but I need the <span class="description">
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" && isset($element['#localized_options']['attributes']['title'])) {
$element['#title'] .= '<span class="description">' . $element['#localized_options']['attributes']['title'] . '</span>';
}
$output = l($element['#title'], $element['#href'], $element['#localized_options']);
return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
}