Drupal – Render a menu in View header or footer

You can render a menu in the header/footer of a view. Add the following code to either one of them.

<?php
  print theme('links', menu_navigation_links(<menu id>), array('class' => 'menu <custom-class>'));
?>


 

The <menu id> could be found by moving your mouse over the configure link @ Adminster -> Site building -> Blocks. The <menu id> of Primary links is primary-links as shown in the following picture.

 

Done =)

Reference: Add a custom menu to the header or footer of a views display (page or block)

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

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