Make WordPress Core

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#32712 closed enhancement (duplicate)

Customizer Menus: add a way to extend available menu items

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

Description

Moving this over from https://github.com/voldemortensen/menu-customizer/issues/103

From @sevenspark:

Can we add a way to extend available menu items?

In the Appearance > Menus screen, we can use add_meta_box to insert custom menu item types.

However, in available_items_template(), there isn't the ability to add any additional types of menu items (though I see there is an @todo note regarding add_meta_box)

Right now, the Menu Customizer doesn't interfere with any custom items added in Appearance > Menus as far as I can tell, so that's good. But it'd be nice to be able to add them via the Customizer interface as well.

I think just adding an action hook would probably be all we'd need.

Thanks! :)

Change History (3)

#1 @designsimply
10 years ago

Also copying in @westonruter's previous comment from https://github.com/voldemortensen/menu-customizer/issues/103#issuecomment-111257349 because it's worth noting:

Yes, this is something that needs to be added at some point. I have an initial TODO for where we can pick up additional controls added: https://github.com/WordPress/WordPress/blob/f5fa907f77ea0b3e1035de96c6de6c1be37b4688/wp-admin/js/customize-nav-menus.js#L1061

What comes to mind to implement this is:

  1. Ability to add new controls to the template.
  2. Connect the new controls to the setting, with custom validation logic.
  3. Add support for filtering the postmeta for a given nav_menu_item so that any custom fields will get previewed as expected.
  4. Update the WP_Customize_Nav_Menu_Item_Setting to store any non-core attributes in postmeta, and draw from postmeta when obtaining the setting value.

The first two can be done in JS now, although there isn't a nice API for doing it.

#2 @ocean90
10 years ago

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

Duplicate of #32708.

This ticket was mentioned in Slack in #core-customize by westonruter. View the logs.


10 years ago

Note: See TracTickets for help on using tickets.