By big_smile on
In Drupal 7, you can use the following code in your page.tpl.php file to display the Main and secondary menus.
<?php print theme('links__system_main_menu', array('links' => $main_menu, 'attributes' => array('id' => 'main-menu', 'class' => array('links', 'inline', 'clearfix')), 'heading' => t('Main menu'))); ?>
<?php print theme('links__system_secondary_menu', array('links' => $secondary_menu, 'attributes' => array('id' => 'secondary-menu', 'class' => array('links', 'inline', 'clearfix')), 'heading' => t('Secondary menu'))); ?>
The code is really handy, because you can assign IDs and Classes to the menus.
However, I want my secondary menu to be a child of the main menu.
For example:
<ul id="custom-id">
<li> Main Menu Link 1</li>
<li> Main Menu Link 2</li>
<li> Main Menu Link 3</li>
<li> Main Menu Link 4
<ul id="custom-id">
</li> Secondary Link 1</li>
</li> Secondary Link 2</li>
</li> Secondary Link 3</li>
</ul>
</li>
</ul>
How can I do this?
Comments
Go to
Go to admin/structure/menu/settings and set 'Source for the Secondary links' to 'Main menu'.
This worked for me! Thanks!
This worked for me! Thank you.
Make sure $secondary_links is available in page.tpl for child items of main menu to appear.
I have the same problem
I've set the source for the links of both the Main and Secondary Links to my custom menu and even though I can show the first level with
I can't show the children nested within their parents. Any solutions? The original poster didn't mention if he solved his problem but I can't solve mine this way...
There's a module for
There's a module for that!
Menu block module.
There are very detailed
There are very detailed instructions at http://deltup.org/page.php?4/bartik to create drop-down menus in Bartik theme, which you should be able to adapt to any theme.
There HAS To Be An Easier Solution - Or No?
Please, could someone help me enable secondary menu or child menu items from the main menu?
I have made the main menu the source for both primary and secondary links, but I still see no secondary drop-down links under the main menu. I have checked all of my settings for the secondary page, the menus, and my content types.
I found the instructions from the Bartik theme, but these are far too complicated for something as simple as wanting to see a drop-down main menu. I have minimal PHP coding ability or experience, and I can't believe it would be this difficult to get one of the most basic elements of web page design from this CMS. I tried multiple themes, but none of them show child menu items.
I tried installing Superfish, which I had installed successfully for another site in Drupal 6, but after Drupal 7 installed the 7 version from the Zip file, it never appeared in the modules list. It simply doesn't exist.
Can anyone clarify or demystify this? What do I have to do to get child menu items to show up when hovering over the parent main menu items?
=-=
is your theme printing the @secondary menus variable in your theme?
have you tested a core theme?
note, secondary menus are not drop down menus.
video for seondary menus = http://www.lullabot.com/node/444/play
superfish for Drupal 7.x works perfectly fine here.