Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#14354 closed enhancement (invalid)

Abilty to add classes to menu items

Reported by: rfair404 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)

  • Keywords reporter-feedback added

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.

comment:2 follow-up: ↓ 3   nacin3 years ago

Also -- wp-admin/nav-menus.php, Screen Options > Classes.

comment:3 in reply to: ↑ 2 ; follow-up: ↓ 4   filosofo3 years ago

Replying to nacin:

Also -- wp-admin/nav-menus.php, Screen Options > Classes.

I thought that's what I said. :)

Thanks for making it clearer.

comment:4 in reply to: ↑ 3   nacin3 years ago

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

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.