Version 8.8 of the Advanced Sidebar Menu plugin is now available and ready for general use.
This version focused on creating universal CSS classes between all 3 widgets and introduced several new helper methods.
Universal CSS Classes
From the beginning, the 3 widget types treated CSS classes a little differently. While some CSS classes were common, such as
children, some of the CSS classes used to target a menu item’s state were different across widget types. Each widget followed the WordPress core CSS class convention. For example, the category widget would use
current-cat while the pages widget would use
current_page_item to target the current item with CSS.
Going forward we’ve added common classes to each widget.
menu-item– Targets each widget menu item.
current-menu-item– Targets the current menu item.
current-menu-parent– Targets the current menu item’s parent.
By using the same classes in each widget, we were able to reduce the generated CSS by 2/3rds! You may do the same for any custom CSS you have written which targets multiple widget types.
For backward compatibility, we kept the existing CSS classes intact so your customizations will continue to work.
We also added all the default CSS classes back to Navigation widgets in case themes or developers want to use them to enhanced the Navigation menus.
New Version Requirements
- Going forward we will no longer support WordPress 5.3 and earlier.
- Version 8.8 of PRO now requires a minimum version 8.8 of basic to function.
Enhanced Navigation Hierarchy Helpers
When using actions to adjust the functionality of a Navigation widget (commonly using the
advanced-sidebar-menu/menus/navigation/objects/excluded action) the most helpful tool arguably is the
Objects class found in the
Advanced_Sidebar_Menu\Nav_Menu namespace. This class allows you to easily parse or iterate through the available menu items.
To extend the ability to customize the menu, we’ve introduced some methods which have no internal use but are instead written for extending.
Tests if a page exists within the current hierarchy. Useful for checking if a page exists in the menu or if a page no longer exists after the hierarchy has been filtered.
Removes all menu items from the widget which is no longer in the hierarchy. Useful for cleaning up the menu after you have parsed and edited the hierarchy. If the hierarchy has not been edited, this method does nothing.
Retrieves all top level items in the current menu. This is for custom implementations where you just want to work with the top level items, or to aid in parsing the menu.
Enhanced Category Menu Class
Category menu class is used to parse a category menu and determine common things like:
- Should this widget be displayed.
- The arguments to pass to
- What level we are on.
Version 8.8 introduces some new methods used both internally and available externally to test and interact with the current menu. Because the widget supports custom taxonomies, the word “term” is synonymous with “category.”
Checks if term is the term being viewed on the site. Useful for targeting or retrieving the current term.
Retrieves a list of all ancestors of term being viewed or all ancestors of terms assigned to the post being viewed. Most often will be used internally by
is_current_term_ancestor but available in case you need the list.
Checks if a term is being used as the current top level term in the menu. This honors only the current top level when iterating during menu output. If used outside menu output, the result will always be false.
- Prevented cross excluding of menu items when using multiple widgets on the same page.
- Tested to WordPress 5.9.3.
- Improved deployment configurations to assure stability.
- Removed legacy translation of font-weights. If you haven’t updated your widget settings for 2 years, you’ll want to double check your widget style settings.