1

I'm working in drupal for the first time and I'm coming along nicely and learning as I go. I need to remove the UL and LI from my menu so I've been doing some research and "MYTHEME_menu_tree_menu_name" was suggested to override the container. As A test I'm trying this in my template.php file:

function storm_menu_tree__menu_social_media($variables) {
  return '<span class="test-menu">' . $variables['tree'] . '</span>';
}

Where "storm" is my theme name. My menu name is "Social Media" but D7 shows the machine name as "menu-social-media".

When I test this nothing is affected. What am I missing?

I should note this is a sub-theme based off Zen Theme.

--- edit ---

this is what I'm using to call the menu:

<?php
$menu_name = 'menu-social-media';
$menu_id = 'social-media';
print theme('links', array('links' => menu_navigation_links($menu_name), 'attributes' => array('id' => $menu_id, 'role' => 'navigation', 'class'=> array('links', 'inline'))));
?>

1 Answer 1

2

Drupal 7 theme can implement a THEMENAME_menu_tree__MENU_NAME() or THEMENAME_menu_link__MENU_NAME() function to override theme_menu_tree() or theme_menu_link() for a specific menu.

References for overriding the specific menu:

Can you once try passing $variables as reference to the THEMENAME_menu_tree__MENU_NAME() as below:

function storm_menu_tree__menu_social_media($variables) {
  return '<span class="test-menu">' . $variables['tree'] . '</span>';
}

Note: Clear the cache after making the changes to the code in order to make sure implemented changes reflects on the site.

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.