Display a Custom Menu in a Drupal 7 Theme Template File

18th August 2012

For reference, this is the code needed to display a menu in a Drupal 7 template file, including the navigation ARIA role.

$menu_name = 'menu-footer-menu';
$menu_id = 'footer-menu';
print theme('links', array(
  'links' => menu_navigation_links($menu_name),
  'attributes' => array(
     'id' => $menu_id,
     'role' => 'navigation',
     'class'=> array('links', 'inline')
  )
));

Tags: drupal, drupal-7, drupal-planet, php, aria

About the Author

Picture of Oliver

Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.

Availability

Currently have limited part-time capacity

Currently no spare full-time capacity.