Custom Menu Wizard Widget
Custom Menu Wizard Widget : Show branches or levels of your menu in a widget, with full customisation.
This plugin is a boosted version of the WordPress "Custom Menu" widget. It provides full control over most of the parameters available when calling WP’s wp_nav_menu() function, as well as providing pre-filtering of the menu items in order to be able to select a specific portion of the custom menu. It also automatically adds a couple of custom classes.
- Display the entire menu, just a branch of it, or even just a specific level of it
- Select a branch based on a specific menu item, or the "current" item (currently displayed page)
- Specify a level to start at, and the number of levels to output
- Select hierarchicial or flat output, both options still abiding by the specified number of levels to output
- Allow the widget title to be entered but not output, or even to be set from the parent item of a menu’s sub-branch
- Optionally disable widget output completely if there are no matching menu items found
- Include a sub-branch’s parent and/or ancestor item(s) in the output, over and above any start level setting
- Automatically add cmw-level-N and cmw-has-submenu classes to output menu items
- Add/specify custom class(es) for the widget block, the menu container, and the menu itself
- Modify the link’s output with additional HTML around the link’s text and/or the link element itself
- Use Ordered Lists (OL) for the top and/or sub levels instead of Unordered Lists (UL)
There are quite a few options, which makes the widget settings box very long. I have therefore grouped most of the options into logical sections and made each section collapsible (with remembered state, open by default).
Set the title for your widget.
Prevents the entered
Titlebeing displayed in the front-end widget output.
In the Widgets admin page, I find it useful to still be able to see the
Titlein the sidebar when the widget is collapsed, but I don’t necessarily want that
Titleto actually be output when the widget is displayed at the front-end. Hence this checkbox.
Select Menu (select)
Choose the appropriate menu from the dropdown list of Custom Menus currently defined in your WordPress application. The first one available (alphabetically) is already selected for you by default.
Show all (radio, default)
Don’t apply the
Children offilter. If you check this option, the
Children ofselect will be disabled, as will the
Title from Parent Itemcheckboxes, as they are only applicable to a
Children of (radio & select)
The dropdown list will present a "Current Item" option, followed by all the available items from the menu chosen in
Select Menu. The widget will output the children of the selected item, always assuming that they lie within the bounds of any other parameters set. If you change
Select Menu, the options presented in this dropdown will change accordingly.
Starting Level (select, default: "1")
This is the level within the chosen menu (from
Select Menu) that the widget will start looking for items to keep. Obviously, level 1 is the root level (ie. those items that have no parent item); level 2 is all the immediate children of the root level items, and so on.
For Depth (select, default: "unlimited")
This is the maximum depth of the eventual output structure after filtering, and in the case of
Flatoutput being requested it is still applied – as if the output were
Hierarchicaland then flattened at the very last moment. You need to be aware that the
For Depthsetting is applied relative to the level at which the first item to be kept is found. For example, say you were to set
Children ofto "Current Item",
Starting Levelto "2", and
For Depthto "2 levels"; if the current item was found at level 3, then you would get the current item’s immediate children (from level 4), plus their immediate children (from level 5).
Hierarchical (radio, default)
Output in the standard nested list format.
Output in a single list format, ignoring any parent-child relationship other than to maintain the same physical order as would be presented in a
Include Parent (checkbox)
If checked, include the parent item in the output. Only applies to a successful
Include Ancestors (checkbox)
Include Parentexcept that all ancestors, right back to root level, are included. Only applies to a successful
Title from Parent Item (checkbox)
Again, this only applies to a successful
Children offilter. If checked, use the title of the parent item as the widget’s title when displaying the output. This will override (ie. ignore) the
Change UL to OL
The standard for menus is to use UL (unordered list) elements to display the output. These settings give you the option to swap the ULs out for OLs (ordered lists).
Top Level (checkbox)
If checked, swap the outermost UL for an OL.
If checked, swap any nested (ie. not the outermost) ULs for an OLs.
Hide Widget if Empty (checkbox)
If checked, the widget will not output any HTML unless it finds at least one menu item that matches the Filter settings.
Element (default: "div")
This menu list is usually wrapped in a "container" element, and this is the tag for that element. You may change it for another tag, or you may clear it out and the container will be completely removed. Please note that WordPress is set by default to only accept "div" or "nav", but that could be changed or extended by any template or plugin.
This allows you to specify you own id (which should be unique) for the container.
This allows you to add your own class to the container element.
Menu Class *(default: "menu-widget")
This is the class that will be applied to the list element that holds the entire menu.
This allows you to add your own class to the outermost element of the widget, the one that wraps the entire widget output.
Before the Link
Text or HTML that will be placed immediately before each menu item’s link.
After the Link
Text or HTML that will be placed immediately after each menu item’s link.
Before the Link Text
Text or HTML that will be placed immediately before each menu item’s link text.
After the Link Text
Text or HTML that will be placed immediately after each menu item’s link text.
Requires: 3.0.1 or higher
Compatible up to: 3.5.1