I need a list of main menu item links to display on a page (sort of a sitemap). How would I accomplish this in Drupal 7?

2 Answers 2

   $menu = menu_navigation_links('main-menu');
   print theme('links__menu_main_page', array('links' => $menu));

Write This code where you want to display menu.

Or you can assign menu block to a region and can call that region like this

print render($page['menu_block']); 
  • Thanks! This is good as well, but I get only the top level items, is there any way to get an array of all top level items and it's children? Commented Jul 23, 2014 at 12:53
  • Print render(menu_block_view('main-menu')) Commented Jul 24, 2014 at 5:20

Go to admin/structure/block and configure the Main Menu block

enter image description here

You want to go further you can Install Menu block module

So… have you ever used the Main and Secondary menu links feature on your theme and wondered “how the hell do I display any menu items deeper than that?”

Well, that’s what this module does. It provides configurable blocks of menu trees starting with any level of any menu. And more!

Not the answer you're looking for? Browse other questions tagged or ask your own question.