By ThePeach on
Hi all, I'm stuck, because with drupal 6 seems like menus are no longer single-styled (with drupal 5 I had ".menu-X-Y-Z" classes) but they only have ".leaf" and ".first" and ".last" classes, which is not enough.
How can I bypass this problem?
The solution I'm using is using a custom block with an html menu inside, but this solution can't have "active" classes as well :(
1) can I reintroduce particular classes for the menus?
2) can I create something that mimic this behaviour with php within the theme?? (how?)
Thank for the help!
Comments
UP!
Please help :(
...
Create a new block and use this snippet (set input format to PHP naturally).
Replace
menu-name-of-my-menuwith the actual name of your menu - to find this go to the menu admin page (admin/build/menu) and hover over the link to your menu, its the last bit of the URL in the status bar (its always called something like menu-xxx).You should probably replace the id with your own CSS selector and to get the menu to display vertically you can use display: block on the li.
Pimp your Drupal 8 Toolbar - make it badass.
Adaptivetheme - theming system for people who don't code.
thanks jmburnz I've found a
thanks jmburnz
I've found a similar way to do that: I added this snippet of php code to page.tpl.php:
in your solutions I didn't get if I need to add the actual menu block after the block with the php snippet you posted
...
The first two lines appear to be doing nothing, all you need to print the primary menu is:
Your original question was not clear if you were asking about primary links or any menu, I assumed it was any menu, since primary links do this anyway.
With the solution I posted you just build a menu and add the snippet where-ever you like, in a block, page.tpl.php etc, this works with normal menus, but it's not really meant for primary or secondary links - all you need is to run them throught the theme_links function and viola (as above).
Pimp your Drupal 8 Toolbar - make it badass.
Adaptivetheme - theming system for people who don't code.
you're right: the first two
you're right: the first two lines did nothing :-( I thought they were needed...
and yes: I was referring to any menu, using primary menu is just a mere convenience.
I'm trying your solution then :)