WordPress Hooks
This plugin is highly extendable using WordPress hooks API. Below are brief descriptions of each of the actions and filters.
Filters
advanced-sidebar-menu/styles/accordion
Used to change the accordion icon styles. May be used to add or remove styles or adjust the output of the icons per style.
Accepts 1 argument:
- An array of available icon styles.
advanced-sidebar-menu-pro/widget-options/page/post-type/available-post-types
Used to change which post types are available for selection in widget.
Accepts 1 argument:
- An array of all hierarchical post types.
advanced-sidebar-menu/styles/bullet_types
Used to change the available bullet types. May be used to add or remove bullet types from the widget options.
Accepts 1 argument:
- An array of available bullet types.
advanced-sidebar-menu/styles/font-weights
Used to change the available font weights. May be used to add or remove font weights from widget options.
Accepts 1 argument:
- An array of available font weights.
advanced-sidebar-menu/menus/navigation/get-nav-menu-args
Used to filter the arguments passed to wp_nav_menu
when using the Navigation Menu widget.
Accepts 2 arguments:
- Default arguments.
- Navigation Menu class.
advanced-sidebar-menu/menus/navigation/is-displayed
Used to limit where the navigation menu may display.
Returning true
does not guarantee the menu will display as the widget settings may still not allow any menu items to show. Returning false
guarantees the widget will not display.
Accepts 4 arguments:
- If this is a page where the menu should display.
- The widget arguments.
- The widget values.
- The full menu object.
advanced-sidebar-menu/menus/navigation/objects/excluded
Pages may be excluded from all menus including the Navigation Menu by using the meta box found on the page edit screens. This filter allows you to change which items are excluded from the Navigation Menu widgets.
Accepts 5 arguments:
- Excluded navigation item ids.
array
- Current menu item.
Advanced_Sidebar_Menu\Nav_Menu\Item
- Nav menu objects class.
Advanced_Sidebar_Menu\Nav_Menu\Objects
- Menu items.
array
- Hierarchy map of menu items.
array
advanced-sidebar-menu/meta/page-meta/link-text
Filter the link text for a page when rendered in a menu. For changing a page’s title programmatically instead of using the page’s settings.
Accepts 3 arguments:
mixed $meta
– The value from the page’s settings.int|string $post_id
– ID of the page being displayed.Page_Meta $instance
– Current instance of thePage_Meta
class.
advanced-sidebar-menu-pro/styles/block-style/levels
When block styles are enabled, each level of the menu requires it’s own padding to allow for indentation. By default, up to 10 levels of menu are supported and CSS is generated for the number of levels selected to display in the menu or for 10 levels if a number is not selected.
Use this filter to decrease the number of levels to cut down on CSS size or increase the number of levels to support larger menus.
Accepts 2 arguments:
- Number of supported levels.
- Widget options.
advanced-sidebar-menu-pro/walker/posts/excluded-ids
Used to change the list of posts which are excluded from the categories widget’s posts listed under categories.
Defaults to the posts excluded via the meta box available when editing hierarchical post types.
Accepts 2 arguments:
- Excluded post ids.
array
- Posts walker class.
Posts
advanced-sidebar-menu-pro/walker/display-posts/get-post-args
Used to change the arguments sent to get_posts
when retrieving the posts to display under a category within the Category Menu widget.
Accepts 6 arguments:
- Arguments being used.
array
- Category posts are being retrieved for.
WP_Term
- Current depth of the menu.
int
- Arguments passed to
wp_list_categories
.array
- Id of the current category.
int
- Display_Posts class.
\Advanced_Sidebar_Menu\Widget_Options\Category\Display_Posts
advanced-sidebar-menu/menus/navigation/is-excluded
Filter whether an individual navigation menu item is exclude from the widgets. Used to exclude/include an item outside of the excluded menu item settings.
Note: A navigation menu item id is not the same as a page or term id.
Accepts 5 arguments:
- If the menu item is excluded.
bool
- Id of the menu item.
int
- The widget arguments.
array
- The widget values.
array
- The full menu object.
Menu_Abstract
advanced-sidebar-menu-pro/widget-options/shared/styles/styles
Used to change the CSS content, separated by sections, which is generated using the widget styles options. All widgets may be changed using this filter.
Accepts 3 arguments:
- Various styles from widget settings.
array
- Menu class.
Advanced_Sidebar_Menu\Menus\Menu_Abstract
- Id of the CSS wrap.
string
advanced-sidebar-menu-pro/widget-options/shared/styles/output
Used to change the CSS which is generated using the widget styles options. All widgets may be changed using this filter.
Accepts 4 arguments:
- Render CSS.
string
- Various styles from widget settings.
array
- Menu class.
Advanced_Sidebar_Menu\Menus\Menu_Abstract
- Id of the CSS wrap.
string
advanced-sidebar-menu-pro/widget-options/taxonomy/taxonomies
Used to change which taxonomies are available for selection in widget.
Accepts 1 argument:
- An array of all hierarchical taxonomies.
advanced-sidebar-menu/widget/category/available-post-types
Used to change the list of available posts types when using the Category Menu widget.
Accepts 2 arguments:
- Post types.
array
- Widget settings.
array
advanced-sidebar-menu/widget/navigation-menu/output
Used to filter the output of the entire Navigation menu widget.
Accepts 4 arguments:
- The widget output.
string
- The widget class arguments.
array
- The widget settings.
array
- The widget class.
Advanced_Sidebar_Menu\Menus\Navigation
advanced-sidebar-menu/widget-options/accordion/icon-styles
Change the CSS which is generated and rendered as an embedded <style>
tag for the accordion related items.
Accepts 5 argument:
array $icon_styles
– CSS property and value list.array $instance
– Widget settings.array $widget_args
– Widget arguments.Menu_Abstract
$menu – Current menu being processed.Accordion $accordion
– Current Accordion class.
Actions
advanced-sidebar-menu/menus/navigation-menu/render/after
Used to run a callback inside the Navigation Menu widget just before the menu is rendered.
Accepts 1 argument:
- Menu class.
Advanced_Sidebar_Menu\Menus\Navigation
advanced-sidebar-menu/menus/navigation/objects/parse-hierarchy
Used to store or adjust the hierarchy of the Navigation Menu widget items before they are rendered. The hierarchy is a array of all items within the menu and their corresponding children.
This action can remove items, move items under different parents, or completely rearrange the menu structure.
Accepts 4 arguments:
- Existing hierarchy.
array
- Current menu item.
false | Advanced_Sidebar_Menu\Nav_Menu\Item
- Objects class.
Advanced_Sidebar_Menu\Nav_Menu\Objects
- Original menu items.
array
advanced-sidebar-menu/menus/navigation/render
Used to run a callback inside the Navigation Menu widget just before the menu is rendered.
Accepts 1 argument:
- Menu class.
Advanced_Sidebar_Menu\Menus\Navigation
advanced-sidebar-menu-pro/walker/display-posts/post-element
Fires during the rendering of a post under a category within the Category Menu widget when display posts is enabled. May be used to output additional markup inside the menu’s post items.
Accepts 3 arguments:
- Current post being rendered.
WP_Post
- Widget settings.
array
- Display Posts Walker class.
Advanced_Sidebar_Menu\Walkers\Display_Posts
advanced-sidebar-menu/widget/after-render
Fires after a widget is rendered outside of the widget wrap. Used to add additional content to the sidebar or run callbacks right after render.
While the PRO version adds this action for the Navigation Menu widget, the basic version also has this action for both the Page Menu widget and Category Menu widget. It will fire on all 3 widget types.
Accepts 2 arguments:
- Menu class.
Advanced_Sidebar_Menu\Menus\Navigation
- Widget class.
Advanced_Sidebar_Menu\Widgets\Navigation_Menu
advanced-sidebar-menu/widget/navigation-menu/after-form
Fires after the widget settings for the Navigation Menu widget. Used to add additional settings and/or text.
Accepts 2 arguments:
- Widget settings.
array
- Widget class.
Advanced_Sidebar_Menu\Widgets\Navigation_Menu
advanced-sidebar-menu/widget/navigation-menu/before-form
Fires before the widget settings for the Navigation Menu widget. Used to add additional settings and/or text.
Accepts 2 arguments:
- Widget settings.
array
- Widget class.
Advanced_Sidebar_Menu\Widgets\Navigation_Menu
advanced-sidebar-menu/widget/navigation-menu/left-column
Fires within the left column of the widget settings for the Navigation Menu widget. Used to add additional settings and/or text.
Accepts 2 arguments:
- Widget settings.
array
- Widget class.
Advanced_Sidebar_Menu\Widgets\Navigation_Menu
advanced-sidebar-menu/widget/navigation-menu/right-column
Fires within the right column of the widget settings for the Navigation Menu widget. Used to add additional settings and/or text.
Accepts 2 arguments:
- Widget settings.
array
- Widget class.
Advanced_Sidebar_Menu\Widgets\Navigation_Menu
advanced-sidebar-menu/widget/navigation-menu/styles-box
Fired within the default styles widget settings for the Navigation Menu widget. Used to add additional settings and/or text.
Accepts 2 arguments:
- Widget settings.
array
- Widget class.
Advanced_Sidebar_Menu\Widget\Widget
advanced_sidebar_menu_widget_pre_render
Fires before a widget is rendered outside of the widget wrap. Used to add additional content to the sidebar or run callbacks right before render.
While the PRO version adds this action for the Navigation Menu widget, the basic version also has this action for both the Page Menu widget and Category Menu widget. It will fire on all 3 widget types.
Accepts 2 arguments:
- Menu class.
Advanced_Sidebar_Menu\Menus\Navigation
- Widget class.
Advanced_Sidebar_Menu\Widgets\Navigation_Menu