#14354 closed enhancement (invalid)
Abilty to add classes to menu items
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Menus | Version: | 3.0 |
| Severity: | normal | Keywords: | reporter-feedback |
| Cc: |
Description
Sure would be nice if I could add classes to the menu items created by wp_nav_menu. For example, I could add a class "last" to the last li generated by the menu, therefor being able to style it differently from the rest. same with the first. I think it would be nice, from a theme development standpoint for this to be default. But also be nice if I could add class contact or something to a specific element, therefor being able to put a custom background image, etc in my stylesheet.
Change History (6)
Also -- wp-admin/nav-menus.php, Screen Options > Classes.
Replying to nacin:
Also -- wp-admin/nav-menus.php, Screen Options > Classes.
I thought that's what I said. :)
Thanks for making it clearer.
Replying to filosofo:
I thought that's what I said. :)
Thanks for making it clearer.
Ah, that you did. I just kind of read through it and saw mention of the filter, and realized rfair404 may not have noticed the screen options to boot.
- Resolution set to invalid
- Status changed from new to closed
I feel silly, oh so silly for missing that one. Thanks all

You can add classes to each menu item individually and directly. If you want to add a particular class automatically, you should be able to do it using the nav_menu_css_class filter.
If there's something you still are not able to accomplish using the existing filters, please elaborate.