Why is so dang difficult to style the main menu once you put in the sidebar in Drupal 7?!?

i also want to remove those annoying leaf classes! first leaf, leaf, last leaf etc.

on the page template file i see the main nav code and where it spits out title, but in the same file, all the side bar code is in one variable. how do i access that?,

i don't mind php coding. can someone please advise how to do this?

big thanks in advance

  • Did you place it in the side bar via a Block?
    – Geoff
    May 9, 2014 at 0:28
  • yes i placed in SideBar
    – TopTomato
    May 10, 2014 at 0:22
  • you can override a block's title by explicitly giving it a title of <none> . As for the classes, I believe you would need to override a hook as webkenny suggested.
    – Geoff
    May 10, 2014 at 4:27

1 Answer 1


Welcome to the wild world of theme functions, friend. You're going to need to do some overriding of the main menu in a file called "template.php" which should be included in whatever base theme you're using. Create a function in that file that looks something like this:

function MYTHEMENAME_menu_link($variables){ // Code here }

Use this link as reference to understand how to change what's there: https://api.drupal.org/api/drupal/includes%21menu.inc/function/theme_menu_link/7

And for a real brain buster on everything you want to know about how to theme menus, check out this answer by Sheena, who's basically a genius: Advanced menu theming in Drupal 7

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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