So I want menus to output in a custom way. I would not output the following HTML.

<ul attributes>
    <li attributes>
       <a href="foo">foo</a>
    <li attributes>
       <a href="bar">bar</a>

I would replace it with the following one.

<nav attributes>
   <a attributes href="foo">foo</a>
   <a attributes href="bar">bar</a>

So I put in the template.php file the following function (my theme is called mFAC).

function mFAC_links($variables) {
    // custom stuff

I am starting with a light alteration, but nothing seems to have any effect. I cleared the cache.

Is there anything I am missing?

  • Did you rebuild the theme registry == clear caches ? And BTW, your function should return $output. Does it ?
    – Countzero
    Apr 19, 2012 at 6:00
  • So far I have just copied and pasted the function from theme.inc with only a slight variation to test that its having an effect. I cleared the caches and it does return $output Apr 19, 2012 at 6:07
  • How are your links output in your tpl.php ?
    – Countzero
    Apr 19, 2012 at 6:30

2 Answers 2


You can use YOUR_THEME_menu_tree() for this. You can target it to a specific menu using YOUR_THEME_menu_tree__MENU_NAME(). Make sure you return the variable after alterations. Refer this for more details.


You can override the menu wrapper in this manner:

function YOURTHEME_menu_tree__MENU_NAME($variables) {
  return '<nav class="menu'.$variables['delta'].'">' . $variables['tree'] . '</nav>';

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.