Different classes for main and sub-menu?

Category
drupal, menus
Date Created
9th Feb 2010
Last Updated
9th Jul 2010

Different classes for main and sub-menu?

Question

How to set-up different classes for main and sub-menu?

Answer

The code below should be entered within your template.php file and will give the main menu a class of "topnav" and sub-menus a class of "subnav".

function phoenix_menu_tree($tree) {
 return '
    '. $tree .'
'; } function phoenix_menu_item($link, $has_children, $menu = '', $in_active_trail = FALSE, $extra_class = NULL) { $class = ($menu ? 'expanded' : ($has_children ? 'collapsed' : 'leaf')); if (!empty($extra_class)) { $class .= ' '. $extra_class; } if ($in_active_trail) { $class .= ' active-trail'; } $vars['primary_links_tree'] = preg_replace('/

Related terms