Output menu anywhere in theme


Get raw version
  1. <?php print theme('links', menu_navigation_links('your-menu-name'));?>


doubouil's picture

This will print the menu relative to your page ( menu_tree_page_data is used).

Also, this will print it via theme_links, which rely on theme_item_list, so keep in mind that theme_menu_item and theme_menu_item_link are not called.

Another way to do it :

print menu_tree_output( menu_tree_page_data("your-menu-name") );

And if you need the whole menu :

print menu_tree_output( menu_tree_all_data("your-menu-name") );

Use the first if you need to customize the links array before render (example : adding classes to li items), and second if you just want to print out a menu.