Can I use the function menu_tree()
in Drupal 7 to customize a menu and add CSS classes? I've tried to customize a main_menu by adding CSS classes: Is it the right way?
1 Answer
The easiest way to add custom classes to menu items in Drupal 7 is the Menu Attributes module.
If you really want to do this programmatically, then you can override the theme_menu_link() function in your theme's template.php file. Be sure to read the drupal.org documentation on Overriding Themable Output.