I am new to Drupal and am porting a Joomla site to D7, whereby the Joomla site has multi-line menu items with the second line italiziced. I am using Views for my pages and have created the main navigation menu using Admin/Structure/Menus/Main Menu.
The html in the Joomla site looks like this:
<div id="main-menu">
<ul>
<li class="level1 item1 active current">
<a href="/page-1">
<span class="title">Menu Item Title</span>
<span class="subtitle">Menu Item Subtitle</span>
</a></li></ul></div>
The pertinent css for breaking the line and italicizing:
#main-menu span.subtitle {
font-style: italic;
display: block;
}
I've researched many posts and many approaches for wrapping menu items in span tags and modifying menu item attributes. However, I have only found one approach for allowing inline html in menu items. It entails adding this code to template.php:
function MYTHEME_menu_link__MENUNAME($variables)
{
$element = $variables['element'];
$sub_menu = '';
if ($element['#below']) {
$sub_menu = drupal_render($element['#below']);
}
// Enable this to use html in title, eg img, span or something else...
$element['#localized_options']['html'] = true;
$link = l('' . $element['#title'] . '', $element['#href'], $element['#localized_options']);