Fix for How to Create a Full Sub Menu starting from the second level of Nav using the default menu theme

  1. <?php
  2.         $tree = menu_tree_page_data(variable_get('menu_primary_links_source', 'primary-links'));
  3.         foreach( $tree as $key => $menu){
  4.                 if(is_array($menu[link]) && !empty($menu[link][in_active_trail])){
  5.                                 $newarray[] = $menu[below];
  6.                                 break;
  7.                 }
  8.         }
  9.         foreach($newarray as $sub) #This is kinda gross but how will we know what the key is?  
  10.                 $output = menu_tree_output($sub);
  11.                
  12.        # And a simple string replace of your navigation id will get you
  13.        # a sub-nav menu for placement anywhere you can put php code...
  14.         print str_replace('<ul id="nav">', '<ul id="sub-nav">', $output);
  15. ?>

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.