Template Overrides
You may override the full output of the either widget by using a template override. In the plugins folder you will find a folder named “views”. The following files will be found there:
- category_list.php – category widget output
- page_list.php – page widget output
To use your own file, create a directory in your active theme named “advanced-sidebar-menu”. Copy any of the above named files into that directory and the plugin will automatically use your version of the file.
Filters
This plugin is highly extendable using WordPress filter API. Although the names are pretty self explanatory, I will briefly describe them.
Page Widget
advanced-sidebar-menu/menus/page/excluded
Filters the excluded pages during widget rendering. Used to exclude or force include pages for all widgets.
Accepts 5 arguments:
- The excluded pages.
- The current page.
- The widget arguments.
- The widget values.
- The full menu object.
advanced-sidebar-menu/menus/page/is-excluded
Filter whether an individual page is exclude from the widgets. Used to exclude/include an item outside of the excluded pages settings.
Accepts 5 arguments:
- If the page is excluded.
bool
- Id of the page.
int
- The widget arguments.
array
- The widget values.
array
- The full menu object.
Menu_Abstract
advanced-sidebar-menu/list-pages/parse-args
Used to change the arguments used when calling get_pages() or wp_list_page() during render of the menu. Runs after the arguments have been parsed.
Accepts 2 arguments:
- The arguments for the menu.
- The complete object used to list pages with properties set.
advanced-sidebar-menu/list-pages/first-level-child-pages
Filters which pages are used to create the first level child pages menu of the current page. Used to include or exclude custom pages from the child menu(s).
Accepts 3 arguments:
- An array of the child pages.
- The full List_Pages object.
- The full Menu object.
advanced-sidebar-menu/menus/page/is-displayed
Filters where the menu may be used. Used to allow rendering the menu on pages like home that are not necessarily a single page. Should be used in conjunction with the ‘advanced_sidebar_menu_top_parent’ filter.
Accepts 4 arguments:
- If this is a proper single page where the menu should display.
- The widget arguments.
- The widget values.
- The full menu object.
advanced-sidebar-menu/menus/page/order-by
Filters which field the pages are ordered by. Used to allow sorting by a custom field or a strictly specified one.
Accepts 4 arguments:
- The current order_by field.
- The widget arguments.
- The widget values.
- The full menu object.
advanced-sidebar-menu/menus/page/output
Filters the complete output of the page list widget. Used to customize the Advanced Sidebar Pages Menu widget output.
Accepts 4 arguments:
- The complete output.
- The widget arguments.
- The widget values.
- The full menu object.
advanced-sidebar-menu/widget/page/update
Runs during a widget save. Used to change values being saved in the widgets.
Accepts 2 arguments:
- The widget values.
- The old widget values.
advanced-sidebar-menu/menus/page/post-type
Filters the post type being used in the widgets. Used to allow the menu to use a custom post type other than page.
Accepts 4 arguments:
- The current post type (default ‘page’ ).
- The widget arguments.
- The widget values.
- The full menu object.
advanced-sidebar-menu/menus/page/top-parent
Filters which page is used as the top parent. Used to specify the page to be used as the top level parent page, which the menu is built off of.
Accepts 4 arguments:
- The current top parent page.
- The widget arguments.
- The widget values.
- The full menu object.
advanced-sidebar-menu/menus/page/order
Filters the order which pages are displayed. May be set to either “DESC” or “ASC”.
Accepts 4 arguments:
- The current order (defaults to “ASC”).
- The current page.
- The widget arguments.
- The widget settings.
- The full menu object.
Category Widget
advanced-sidebar-menu/menus/category/included-term-ids
Filters which categories are considered current and used to populate the menu. If on a term archive the default is the current term. If on a single, the default is all categories assigned to the current post.
Accepts 4 arguments:
- Array of category ids which will be displayed.
- The widget arguments.
- The widget values.
- The full menu object.
advanced-sidebar-menu/menus/category/get-child-terms
Filters which categories are included as first level children.
Accepts 2 arguments:
- Array of WP_Term[] which will populate the first level children.
- The full menu object.
advanced-sidebar-menu/menus/category/excluded
Filters the excluded categories during widget rendering. Used to exclude or force include categories for all widgets.
Accepts 5 arguments:
- The excluded categories.
- The widget arguments.
- The widget settings.
- The full menu object.
advanced-sidebar-menu/menus/category/order-by
Filters what field the categories are ordered by. Used to order categories by a specified field.
Accepts 4 arguments:
- Field the categories are ordered by (defaults to name).
- The widget arguments.
- The widget values.
- The full menu object.
advanced-sidebar-menu/menus/category/is-excluded
Filter whether an individual term is exclude from the widgets. Used to exclude/include an item outside of the excluded category settings.
Accepts 5 arguments:
- If the term is excluded.
bool
- Id of the page.
int
- The widget arguments.
array
- The widget values.
array
- The full menu object.
Menu_Abstract
advanced-sidebar-menu/menus/category/order
Change the order of the categories. Accepts “ASC” or “DESC”.
Accepts 4 arguments:
- Current order (defaults to “ASC” ).
- The widget arguments.
- The widget values.
- The full menu object.
advanced-sidebar-menu/menus/category/output
Filters the complete output of the category list widget. Used to customize the Advanced Sidebar Categories Menu widget output.
Accepts 4 arguments:
- The complete output.
- The widget arguments.
- The widget values.
- The full menu object.
advanced-sidebar-menu/widget/category/update
Runs during a widget save. Used to change values being saved in the widgets.
Accepts 2 arguments:
- The widget values.
- The old widget values.
advanced-sidebar-menu/menus/category/is-displayed
Filters where the menu may be used. Used to allow rendering the menu on pages like home that are not necessarily a single category page.
Should be used in conjunction with the ‘advanced-sidebar-menu/menus/category/included-term-ids’ filter.
Accepts 4 arguments:
- If this is a proper single page where the menu should display.
- The widget arguments.
- The widget values.
- The full menu object.
advanced-sidebar-menu/menus/category/taxonomy
Filters the taxonomy used when determining where to display the widget and which terms to display. Used to display the menu on a custom taxonomy (defaults to category).
Accepts 4 arguments:
- The current taxonomy.
- The widget arguments.
- The widget values.
- The full menu object.