WordPress.org

Make WordPress Core

Opened 8 years ago

Last modified 6 months ago

#18816 new enhancement

Add 'offset' parameter and 'ancestral' boolean to wp_nav_menu

Reported by: signyourbikeout Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Menus Keywords: dev-feedback needs-patch
Focuses: Cc:
PR Number:

Description

Since we can now call wp_nav_menu multiple times and there is the very useful 'depth' parameter, I believe adding an 'offset' parameter would be very beneficial in many situations. This would allow you to start at the children of the main pages for example and combined with depth it becomes very powerful. An 'ancestral' => 'true' option could output only menu items that the current page is a descendant of. Currently if you want to display a main menu in the header and then a submenu on page.php you either need a tricky custom walker or terrible CSS 'visibility:hidden' or 'display:none' situations.

Change History (4)

#1 @chriscct7
5 years ago

  • Keywords dev-feedback added

Thoughts on the proposal dev team?

#2 @DrewAPicture
5 years ago

  • Component changed from General to Menus

@signyourbikeout: Would you like to try your hand at a patch or proof of concept?

#3 @signyourbikeout
5 years ago

@DrewAPicture: I don't think I quite have the chops for that. I tried around the time of submitting this, but gave up. Understandable if you just want to close this ticket.

#4 @chriscct7
4 years ago

  • Keywords needs-patch added
Note: See TracTickets for help on using tickets.