Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

Very new to Drupal and a bit confused.

In order to render a menu in my theme I've been using this:

print theme('links', array('links' => $main_menu, 'attributes' => array('id' => 'main-menu', 'class' => array('links')))); 

That works a treat and gives me an extra class on the first and last list items, which I need for styling. It doesn't, however, show any of the nested sub menus. So I found this that again, worked like a charm Show all nested menu links in Drupal 7 and shows all the top-level links in the main menu and the nested ones too. This doesn't give me the extra classes on the first and last list items which I need. Is there any way to use the code from the answer above and give the extra classes on the list items?

Thanks muchly

share|improve this question

1 Answer 1

Check out the Menu Attributes module: http://drupal.org/project/menu_attributes

share|improve this answer
Boom! Nice one fella. Just what I needed. If I had some rep, I'd up-vote you...... –  toby_lh Mar 5 '13 at 13:12
I did it for you. –  SpaceBeers Mar 5 '13 at 13:34
Cheers SpaceBeers. Top name btw. –  danbohea Mar 5 '13 at 14:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.