Hello Community,

I have recently discovered the theme_menu_tree and read the tutorial at:

http://www.nicklewis.org/a-practical-tutorial-on-drupals-menu-system

I am using theme_menu_tree for my primary links menu in 4.7 and I have it working as advertised. However, I would like all the links at the top level to have one class associated with it while its children have a different class.

For example:

MARKERS (style1)

-- red (style2)
-- green (style2)
-- blue (style2)

CRAYONS (style1)

-- red (style2)
-- green (style2)
-- blue (style2)

BRUSHES (style1)

-- red (style2)
-- green (style2)
-- blue (style2)

Can this be done using the theme_menu_tree? Is there another way to do this in 4.7?

Please let me know.

Thanks in advance!

txcrew

Comments

pears447’s picture

Here's a way to control main links and sublinks separately, without assigning different classes (if you need different classes, I can't help you). I've used CSS to handle this before, and it's worked for me. I'm assuming the theme_menu_tree function generates menus by nesting <ul> tags; if that's not the case, you'd need to change the CSS accordingly. For example, where .menu is the class that your entire menu is contained in:

.menu {font-weight: bold}
.menu ul ul {font-weight: normal}

(I just needed to change the font-weight, but you could conceivably change anything.) Hope this helps!