Greg’s Plugins for WordPress

Plugins for WordPress

Portfolio of Plugins for Adoption!

Page Menu Widget

This contextually aware page menu widget is designed to work with CMS-style page organisation, creating a menu on-the-fly that shows just the pages for the branch of the tree where the current page lives.

What this Plugin Makes Possible

Limitations in WordPress’s built in wp_list_pages(), just as in wp_list_categories(), mean that a custom walker is needed when creating a contextually aware menu that shows just a page’s current branch in a tree of pages. This plugin wraps such a custom walker in a widget, together with controls to configure exactly when and how the widget will appear.

How it Works

This plugin communicates with WordPress via the usual widget standards:

  • widgets_init
  • WP_Widget

Configuration and Flexibility

The widget control provides a way to specify the title, sorting of the menu, pages and children to be omitted from the menu or pages and children where the widget will be hidden, specific pages where the widget will be hidden, and a minimum size of the menu (meaning the widget can be easily suppressed when the menu is too small to be usable, such as on a single top-level page with no children). The widget can also be set to show only a top-level page menu, rather than a contextually aware branch menu, on archives, posts, or the home page. The widget control can also add a widget_menu class to the wrapper to make it easier to style with CSS.