Tertiary links in the header region
Last modified: August 23, 2009 - 15:38
Most themes come with two bars of links: primary and secondary. But sometimes you need further levels of menu hierarchy.
(If on the other hand you want sublevels of the Primary menu to appear as blocks, use modules like Menu Block or Menu Trim.)
Add the following function to your theme's template.php file:
/**
* Returns an array containing the tertiary links based on the primary menu.
* Tertiary links can be either a third level of the Primary links
* menu or generated from a second level of the explicitly defined secondary_menu
*/
function menu_tertiary_links() {
$primary = variable_get('menu_primary_menu', 0);
$secondary = variable_get('menu_secondary_menu', 0);
if (!$primary || !$secondary) { //primary and/or secondary links disabled - ergo no tertiary links should be available
return NULL;
}
if ($secondary != $primary) //secondary menu is different from primary - return children of explicitly defined secondary
return menu_primary_links(2, $secondary);
else //all based on primary - return the third level accordingly
return menu_primary_links(3, $primary);
}You need to add this single line into the _phptemplate_variables() function (or add the entire function if it doesn't already exist):
/**
* Override or insert PHPTemplate variables into the templates.... modified
*/
function _phptemplate_variables($hook, $vars) {
$vars['tertiary_links'] = menu_tertiary_links();
}You can now add these lines to you page.tpl.php, below the statements for the primary and secondary links:
<?php if (isset($tertiary_links)): ?>
<?php print theme('links', $tertiary_links, array('class' => 'links tertiary-links')); ?>
<?php endif; ?> Credits: code taken from this forum thread: http://drupal.org/node/86890 See more methods of achieving this there.

Tertiary links for Drupal 6
Paste this into the desirable place in your page.tpl.php:
<?php$tertiary_links = menu_navigation_links(variable_get('menu_primary_links_source', 'primary-links'), 2);
print theme('links', $tertiary_links, array('id' => 'tertiary'));
?>
*******************
http://www.darinka.sk
Hi, Some how this doesnt work
Hi,
Some how this doesnt work for me i have used the above code snippet.
But instead of getting the third level links its always getting the secondary links and displaying the secondary links
Seems that problem is with menu_primary_menu & menu_secondary_menu?
for drupal 6
if anyones trying to do this in Drupal 6, the _phptemplate_variables() function was replaced with phptemplate_preprocess_page().
So instead of
function _phptemplate_variables($hook, $vars) {$vars['tertiary_links'] = menu_tertiary_links();
}
use, the following in drupal 6.x:
function phptemplate_preprocess_page(&$vars) {$vars['tertiary_links'] = menu_tertiary_links();
}
Hope that can help!
blog