Skip to content

Instantly share code, notes, and snippets.

@illepic
Created October 27, 2010 23:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save illepic/650262 to your computer and use it in GitHub Desktop.
Save illepic/650262 to your computer and use it in GitHub Desktop.
Theme menu output to include title class
<?php
// theme menu output to include title class
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';
}
// add title for better cssing
$class .= ' leaf-title-'.str_replace(' ', '-', strtolower(strip_tags($link)));
return '<li class="'. $class .'">'. $link . $menu ."</li>\n";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment