4.6 menu.inc theme_menu_item($mid, $children = '', $leaf = TRUE)
4.7 menu.inc theme_menu_item($mid, $children = '', $leaf = TRUE)
5 menu.inc theme_menu_item($mid, $children = '', $leaf = TRUE)
6 menu.inc theme_menu_item($link, $has_children, $menu = '', $in_active_trail = FALSE, $extra_class = NULL)

Generate the HTML output for a menu item and submenu.

Related topics

1 theme call to theme_menu_item()
menu_tree_output in includes/menu.inc
Returns a rendered menu tree.
2 string references to the theme hook from theme_menu_item()

Note: this list is generated by looking for the string for this theme hook, so it may include some references that are not actually using this theme hook.

drupal_common_theme in includes/common.inc
Provide theme registration for themes across .inc files.
menu_tree_output in includes/menu.inc
Returns a rendered menu tree.


includes/menu.inc, line 1151
API for the Drupal menu system.


function theme_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';
  return '<li class="' . $class . '">' . $link . $menu . "</li>\n";


This function has been renamed to theme_menu_link() in Drupal 7.

I have just installed Drupal 7.20, im fairly new to drupal and theming it, I woudl really like to know where I can get the main menu output to be

  • , the funktion dos not exist, like its describe here. Any help to file and line to where to change it would really be appriciated
  • Warning: different modules like Special menu items and similar could override menu functions like this one, resulting in ignorance towards template.php altering.

    for D6. how do i theme each item element specifically "

  • " tag... i wanted to add some "css class" on the first and last item. while the rest of the elements are just simply clean "
  • " tags...

    please help...