[wp-trac] [WordPress Trac] #19264: Add get_nav_menu_item_children()
WordPress Trac
noreply at wordpress.org
Thu Jan 28 16:20:01 UTC 2016
#19264: Add get_nav_menu_item_children()
-------------------------+-----------------------
Reporter: wpsmith | Owner:
Type: enhancement | Status: reopened
Priority: normal | Milestone:
Component: Menus | Version: 3.0
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
-------------------------+-----------------------
Changes (by eclev91):
* status: closed => reopened
* resolution: wontfix =>
Comment:
Use case here:
There's the main nav on a page, but outside the main nav there may be a
sub nav. Perhaps the main menu is a hamburger menu in the header, then
there's a hero image, and then below that is a sub nav including the
current page and its navigation children (or, if you're already on a
child, its siblings and parent). I can mock that up if it doesn't make
sense.
`wp_nav_menu()` doesn't include an argument for starting with a certain
item or anything, so right now you have to do `wp_get_nav_menu_items()`,
run `_wp_menu_item_classes_by_context()` on that to add the current
classes, use those classes to determine if you need the parent and
siblings or children, fill your own array and the print those out. I can
provide a code sample for this.
Maybe there's a better way of doing this, but it seems like a fair
argument for this function if your nav hierarchy is different than your
page hierarchy.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/19264#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list