Community

Adding class to <LI> list items in custom menu

Hi there.

Trying to do two things here, which I can't seem to accomplish as easily as I did in D6.

Trying to do this without modules for a variety of reasons. Client needs to be able to add items to this menu without having to add classes and other options etc so things like menu attributes are out.

The menu should look like:

-Topic Home <-- add class to this list item
--Topic 1
--Topic 2
-Events Home <-- add (same) class to this list item
--Events 1
--Events 2

1) Print a custom menu, all levels of it (this menu will never have more than 2 levels)
2) Attach a custom class to the <LI> items, in this case Topic Home / Events Home

1) Using:

<?php print theme('links', array('links' => menu_navigation_links('menu-education'), 'attributes' => array('class'=> array('links', 'menu-education')) ));?>

I only get the top level. I'd like the children of the top level items. I have tried a variety of solutions found on the web, none are working.

2) I have tried a variety of hooks, mostly attempting to use theme_menu_link, menu_tree etc. I have yet to find a solution which will allow such.

The classes do not have to be specific to a list item, I just want to add a class to each parent.

Advice would be greatly appreciated.