Getting started – Split Menus
-
NOTE: This documentation is also included in the /documentation/ folder with your plugin download, and is easier to read in that format.
SPLIT MENUS
Many website designs call for a submenu, often right below the primary navigation in the header, or in a sidebar on interior pages. These submenu’s are designed to show the children of the currently active menu item. WP Nav Plus makes it super simple to build out these types of menus, known as “split menus.”
This can be accomplished in one of two ways:
Easy Method (Widget)
The easiest way to get up and running quickly with WP Nav Plus is to make use of the widget. In this section I will show you how to implement a basic split menu using the WP Nav Plus widget.
- Login to your WordPress Admin page (usually https://yourdomain.com/wp-admin)
- Navigate to the Widgets screen (Under “Appearance”)
- Notice the new widget called “WP Nav Plus” (pictured below)<br />
- Click and drag this widget into the desired sidebar placement (pictured below). NOTE: My sidebar is called “Primary Sidebar”, your sidebar may be named differently. Please see your theme documentation for additional details about your sidebars.<br />
- Congratulations, your widget has been successfully installed! Configure the Menu Name, Start Depth, and Depth as needed to reach your desired output.
Advanced Method (Function)
The documentation above has focused on using the WP Nav Plus widget as the easiest way to get started with WP Nav Plus. However for advanced users who want more control over the output of their menu, WP Nav Plus can be used with the built in WordPress wp_nav_menu function
WP Nav Plus adds two arguments to the wp_nav_menu function for use with split menus.
- option: start_depth
- type: int
- default: false
- desctiption: Use this to specify the number of levels “deep” in a nested menu that you wish to start your output from. A setting of 1 will ignore all top level menu items, only showing the nested children menu items associated with the currently active page (if any).
- option: default_category
- type: int
- default: false
- desctiption: When the active page being viewed is a post that is not in the menu structure, it will automatically look for the post index page in your menu to associate the current page with. The default_category option can be used to specify a “fallback” if not post index page is located. Accepts category ID.
Basic Example:
wp_nav_menu( array( 'theme_location' => 'my_menu', 'start_depth' => 1, 'depth' => 1 ) );
The above example would create a menu which does not display any top-level menu items, but does show the children menu items from the active page.
- The topic ‘Getting started – Split Menus’ is closed to new replies.