Getting started – Menu Segments
-
NOTE: This documentation is also included in the /documentation/ folder with your plugin download, and is easier to read in that format.
MENU SEGMENTS
It is sometimes useful to display a particular segment of your WordPress menu on its own. Menu Segments allow you to specify a portion of your menu for display based on the parent menu item. Uses for menu segments could inclue Footer Sitemaps, Mega Menus, or all sorts of other custom menu layout needs.
Build your custom menu layout 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 menu segment 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 />
- Find the parent menu item whose children you wish to display from the dropdown and select it.
- Use multiple widgets as needed to complete your custom layout.
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 one argument to the wp_nav_menu function for use with menu segments.
- option: segment
- type: mixed
- default: false
- desctiption: Choose a segment of the menu to display by specifying the parent of the segment you wish to display. Specify a parent menu item using the items object_id (int) or menu title (string).
Basic Example:
wp_nav_menu( array( 'theme_location' => 'my_menu', 'segment' => 'About Us' ) );
The above example would create a menu which displayed only the children of the ‘About Us’ section, regardless of the currently active page.
- The topic ‘Getting started – Menu Segments’ is closed to new replies.