“How To” add Dropdown Submenus for Drupal 7
You can find the following YouTube video courtesy of Brian Vanaski, which will walk you through replacing the native Drupal menu with a Nice Menu containing drop down menu items: http://www.youtube.com/watch?v=oPP6LNLeGcg. The audio is poor but Brian does a good job providing step-by-step instructions.
Following is a summary of the steps. If you need more details, please check out the video referenced above.
STEP 1: Place a copy of the Bartik Theme in the "Sites/All/Themes" folder.
STEP 2: Change the name of the Bartik folder to a unique name (sub theme).
STEP 3: Change the name of the Bartik.info file (use the same name from Step 2).
STEP 4: Change all occurrences of "bartik" in the “bartik.info” and “template.php” file to your new sub theme name from Step 2.
STEP 5: Install and configure "Nice Menus" and "Menu Block;" make sure to enable Menu Block, Menu Block Export and Nice Menus.
STEP 6: Create your menu structure with both parent and child menu items -- make sure you have checked "Show as expanded" for each parent menu containing submenus.
STEP 7: Replace lines 127 to 138 in the "Page.Tpl.php" (found in the Templates folder) with the following code courtesy of MRadcliffe at: http://drupal.org/node/240831.
<?php
// id, direction, depth should have the values you want them to have.
$menu = theme('nice_menus', array('id' => 0, 'direction' => 'down', 'depth' => 1, 'menu_name' => 'main-menu', 'menu' => NULL));
print $menu['content'];
?>
STEP 8: Configure the CSS for Nice Menus to fit the look and feel of your website.
As a novice Drupal user, I found this process extremely useful. Hopefully you will too. Again, a special THANK YOU to Brian Vanaski and MRadcliffe for doing all the hard work.
If you have a simpler solution, please feel free to comment.
Hey Jen! Thanks for popping in, and great response! I just noticed your comment wasn't published and have gone ahead and posted it. Looking forward to seeing you soon. :)
Cheers,
Chris
In STEP 1 You should NOT make a copy of a core theme.
Creating copies of files that may be updated in future versions of Drupal core is tricky, since you'll need to keep checking all those files for updates, and re-applying changes manually when they occur.
It is far better to create a sub-theme of Bartik. To do that, create a folder inside sides/all/themes with the name of your theme. Then create a file inside that folder with the same name, and a .info extension, as follows:
mytheme/mytheme.info
You'll need to add a few lines to your .info file, as follows:
description = A sub-theme of Bartik.
core = 7.x
engine = phptemplate
base_theme = bartik
By specifying that this theme is a sub-theme of Bartik, it will use all the files from the Bartik theme, unless specifically overridden, thus decreasing the likelihood that you'll need to maintain updates to the theme yourself.
Copy themes/bartik/templates/page.tpl.php into sites/all/themes/mytheme and continue with STEP 5, above.
(Also, the menu_block module is not necessary for this use of nice_menus for your primary links.)