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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s