Download the PHP package mwdelaney/sage-wp-nav-submenu without Composer
On this page you can find all versions of the php package mwdelaney/sage-wp-nav-submenu. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mwdelaney/sage-wp-nav-submenu
More information about mwdelaney/sage-wp-nav-submenu
Files in mwdelaney/sage-wp-nav-submenu
Package sage-wp-nav-submenu
Short Description Get submenu items from a WordPress menu based on parent or sibling
License MIT
Homepage https://github.com/MWDelaney/sage-wp-nav-submenu
Informations about the package sage-wp-nav-submenu
Sage 9 friendly method for getting wp_nav_menu()
submenu items based on parent or sibling
This package is based entirely on this code from levymetal.
The instructions below are also taken from levymetal's excellent documentation.
To install, run the following in your Sage9-based theme directory:
Include the submenu arguemnts in your wp_nav_menu function:
By default, if you have many nested levels, this code will filter the menu by the absolute top level parent. If you want the menu to drill down dynamically by filtering the menu based on the direct parent, pass a "direct_parent" => true
parameter to the wp_nav_menu
call.
If you want to include the parent/root element in the menu, you can pass in a "show_parent" => true
parameter to display the root level item.
If you want to include the parent/root element in the menu even if it has no children, you can pass in a "show_parent_only" => true
parameter to display the root level item.
Of course, you can continue to use the standard wp_nav_menu parameters as well. For example, if you want to limit the number of nested children being displayed, you can use the depth
parameter. Or of you don’t want the menu to be displayed, you can use the echo parameter.