By j0hn-smith on
I want to style menu items in groups depending on class, any body know how I can add custom classes to menu items?
Nice menus are indeed nice but it doesn't look like it has the functionality I'm looking for.
Many thanks
I want to style menu items in groups depending on class, any body know how I can add custom classes to menu items?
Nice menus are indeed nice but it doesn't look like it has the functionality I'm looking for.
Many thanks
Comments
Simplified example
I want to be able to style menu items in groups of my choosing eg
Currently Drupal inserts leaf, collapsed or expanded for the class and nice menus replaces this with a unique id and a unique class for each item, neither has the functionality that I want which is to be able to specify the class of each menu item myself.
I suspect this would require a a new module to place a textbox for the class on the create/edit menu item page admin/build/menu/item/edit/80.
Anyone know how I can add my own class or how easy it would be to create this module and how much work it would involve?
Many thanks
Was thinking the same thing
I was thinking the same thing today. You could then use the class with css to add an image instead of each bullet. I would be very interested in something like this, doesn't sound too complex. Any thoughts?
-Drew
If I understand you
If I understand you correctly, you may find what you're looking for in the template.php file of the GlossyBlue theme. I believe in this theme I came across a custom chunk of code in its template.php file that injects additional class names into menu list items in order to make them more easy to theme.
-- Dave
absolutecross.com
That sounds good but I need
That sounds good but I need to be able to specify custom classes on a per item basis.
I'm expecting to get a module written for this in 3 to 6 months which I'll release.
Great. I am looking for a
Great. I am looking for a solution to be able to theme only one menu item differently. Perhaps already possible with css? Please make your module also drupal 5. Thanks!
greetings,
Martijn
Hi ! I need exactly the same
Hi !
I need exactly the same thing !
Have you find a solution ?
Many thanks for any answer...
- l'°:R -
Maybe this is can be solution for you
Hi , are you mean is every tag < li >is have class ?
So you can giving some costumization for your menu items like adding image or other ?
If so that you can try this :
1. Check you id menu with View Source from your browser
2. You will gettting a different id for each list
3. Giving a costumization CSS based on the tag < li > id
4. Create the costumization in style.css => For make easy to give a overiding costumization
Hope this is usefull :)
Nice
---
http://www.ckcybers.com
Possible solution
Hello. Below I described the solution for PHPTemplate, that worked for me.
I was creating theme, and needed to add some special css class to the A tag. I copied function theme_menu_item_link() from includes/menu.inc to template.php. You should create template.php in you theme directory (near the page.tpl.php, node.tpl.php, etc).
In template.php I changed the name of the function to mytheme_menu_item_link() (where mytheme is the name of my theme :D).
Then I made the following changes:
original:
changed to:
As you can see, I just added the string 'class' => 'side' twice, where side is the name of my css class. That's all.
Good luck!
---
Alexey, Russia.
Menu Attributes module
http://drupal.org/project/menu_attributes
thank you
thank you
another module for the same
this is also a solution:
http://drupal.org/project/menu_css_names
Thanks
Thanks