This repository has been archived on 2025-01-19. You can view files and clone it, but cannot push or open issues or pull requests.
oliverdavies.uk-old-sculpin/source/_posts/display-custom-menu-drupal-7-theme-template-file.md

28 lines
629 B
Markdown
Raw Permalink Normal View History

2015-03-16 21:18:03 +00:00
---
title: Display a Custom Menu in a Drupal 7 Theme Template File
2020-03-08 14:32:13 +00:00
date: 2012-08-18
2018-12-31 12:13:05 +00:00
excerpt: The code needed to display a menu in a Drupal 7 template file.
2015-03-16 21:18:03 +00:00
tags:
2015-06-14 02:27:41 +00:00
- drupal
- drupal-7
- drupal-planet
- php
- aria
2015-03-16 21:18:03 +00:00
---
For reference, this is the code needed to display a menu in a Drupal 7 template
file, including the navigation ARIA role.
2015-06-18 07:58:56 +00:00
2017-03-16 08:09:52 +00:00
```language-php
2015-03-16 21:18:03 +00:00
$menu_name = 'menu-footer-menu';
$menu_id = 'footer-menu';
print theme('links', array(
2015-06-14 02:27:41 +00:00
'links' => menu_navigation_links($menu_name),
'attributes' => array(
'id' => $menu_id,
'role' => 'navigation',
'class'=> array('links', 'inline')
)
2015-03-16 21:18:03 +00:00
));
2017-03-16 08:09:52 +00:00
```