Hooks into WordPress core function wp_list_pages, and removes pages from the generated list that are not part of the current navigation path.
Hooks into WordPress core function
wp_list_pages, and removes pages from the generated list that are not part of the
current navigation path. This creates an accordion navigation effect, and is an alternative approach to the CSS-based
way suggested in the Codex.
By removing unneeded HTML elements server-side, page size is reduced, and client-side rendering will usually be faster. This is especially true for older browsers, and sites with a large number of published pages.
This plugin is intended to be used with the "pages" widget that comes with WordPress, or any navigation element that uses wp_list_pages.
There are two ways the plugin can apply the filter.
Please note that since the second option uses the wp_list_pages hook, the filtering will take place anywhere wp_list_pages is used. This includes menu locations to which no custom menu is assigned. Please make sure all your menu locations have a custom menu assigned to them to avoid unexpected behavior.
This plugin requires the PHP DOMDocument extension, and PHP5.