Drupal 7 – Render the Nice Menus programmatically

The following piece of code will print the Nice Menus block.

$menu = theme('nice_menus', array('id' => 1, 'direction' => 'down', 'depth' => 1, 'menu_name' => '<menu-machine-code>', 'menu' => NULL));
print $menu['content'];

 

you can input any value in the <id> parameter and the rendered menu will have the HTML tag id = nice-menu-<id>. Just make sure there is no duplicated nice menu id in the same page.

Done =)

Reference: How to display nice_menus programmatically in Drupal 7

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.