Answer the question
In order to leave comments, you need to log in
Set class for li and a in menu?
Hello.
I display the menu in the template like this:
print theme('links', array('links' => menu_navigation_links('menu-company'), 'attributes' => array('class'=> array('links', 'footer-nav footer__nav')) ));
function mytheme_menu_link(array $variables) {
$element = $variables['element'];
$sub_menu = '';
if ($element['#below']) {
$sub_menu = drupal_render($element['#below']);
}
$element['#attributes']['class'][] = 'footer-nav__item';
$output = l($element['#title'], $element['#href'], $element['#localized_options']);
return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
}
Answer the question
In order to leave comments, you need to log in
into template
<?php
$menu = menu_tree('mymenu');
echo render($menu);
?>
function mytheme_menu_link(array $variables) {
$element = $variables['element'];
$sub_menu = '';
if ($element['#below']) {
$sub_menu = drupal_render($element['#below']);
}
$element['#attributes']['class'][] = 'footer-nav__item';
$output = l($element['#title'], $element['#href'], $element['#localized_options']);
return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question