0
<?php if (isset($custom_links)) { ?>
<div id="secondaryNav"><?php print theme('links', $custom_links) ?></div>
<?php } ?> 

I've create a custom menu (machine name: menu-secondary-menu). And I want to display it in page.tpl. My condition is to show this this menu only if it has links added. I searched and found the above code. Please help me in customizing to my need.

0
<?php
// Enter the machine name of the menu you want to show.
$menu_name = 'main-menu';
// Check if there are any menu items in it.
if (count(menu_navigation_links($menu_name))):
?>
<div id="secondaryNav">
  <?php print theme('links', array('links' => menu_navigation_links($menu_name), 'attributes' => array('id' => $menu_name, 'class'=> array('links', 'inline')))); ?>
</div>
<?php endif; ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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