Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#36800 closed enhancement (wontfix)

Add object ID to menu item class name

Reported by: selnomeria's profile selnomeria Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Menus Keywords:
Focuses: Cc:

Description (last modified by swissspidy)

When i create custom menu, and i.e. there is included a category/page in the menu (as you already add word "category" or "page" in the class name), please, add the ID of that category/page too... that will be a much help.

or give us a possibility at least, if i define constant (in my functions.php) SHOW_ID_IN_CUSTOM_MENUS to true, then in this case. (or include slug name too.. will be good)

Change History (3)

#1 @swissspidy
9 years ago

  • Component changed from General to Menus
  • Description modified (diff)
  • Summary changed from Add ID into menu CLASSNAME to Add object ID to menu item class name

#2 @swissspidy
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Hey there,

If you want to add specific classes to menu items, you can use the nav_menu_css_class filter for that. Check out the documentation for this hook: https://developer.wordpress.org/reference/hooks/nav_menu_css_class/

So there's already a way to do that. We do not add constants for this. Instead, WordPress has a powerful hooks/filters system.

#3 @selnomeria
9 years ago

thanks!

Note: See TracTickets for help on using tickets.