Drupal Answers is a question and answer site for Drupal developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using this template.php function:

function mytheme_menu_tree($variables) {
    return '<ul class="page_nav" id="pages">' . $variables['tree'] . '</ul>';

Now it applies to the menu no matter in which region it is. What if I want it to apply only if the menu is inside i.e. Top Menu region? I guess its something that needs to be added before return line?

Also I noticed another problem. It applies to all menus, i.e. if I have two menus, my return line applies to both menus, and 2nd menu is not even shown because id="" can be shown only once.

So I need that function to apply to the menu which is in Top menu region only.

share|improve this question
up vote 1 down vote accepted

You can use theme_menu_tree__MENU_NAME() to target a specific menu.

share|improve this answer
Yes, but I cannot predict what menus the users will be creating and using. – user13176 Jan 30 '13 at 17:09

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.