Collapsing Page Menus Plugin

Wednesday, October 4th, 2006

UPDATED! This plugin now works in WordPress versions greater than 2.0!Collapsing Page Menus is a WordPress 1.5+ plugin that generates a collapsing menu of your site pages as an unordered list. The current version is 1.1 and was released on May 23, 2007.I have not tested this plugin under WordPress versions earlier than 1.5. However, I suspect it works correctly in most WordPress versions.Please submit any comments, bug reports, and other issues in the comments to this post.

Download

Collapsing Page Menus[.zip ]

Installation

Collapsing Page Menus is installed by decompressing the zip file above and uploading the collapsing_page_menu.php file to your plugins directory (/wp-content/plugins/) and then enabling the plugin in the WordPress Plugins administration screen.

Use

Once you’ve activated the plugin, you can produce a collapsing page menu by inserting the following in your template file:< ?php echo collapsing_page_menu(); ?>The function also has 6 parameters that you can use to tailor the display of the unordered list.collapsing_page_menu ( $root_id = 0, $order_by = 'menu_order', $order_dir = 'ASC', $css_li = 'page_item', $css_li_selected = 'current_page_item', $current_id = '' )

  • $root_id: The parent page ID. If you’d like to have all of your pages in the menu, use 0. To show only sub-pages of a particular page, use that page’s ID. Note that the given page will not display as part of the menu.
  • $order_by: The database field to use for record ordering.
  • $order_dir: The direction in which to order the pages.
  • $css_li: The CSS class for every page li.
  • $css_li_selected: The CSS class for the current page li.
  • $current_id: Override in cases where the $post variable is compromised or inaccurate. Most of the time, you won’t need to use this parameter.

If you have found the plugin useful, please leave me a comment with a link to your site and I will add it here.

Version History and Changelog

  • 1.2 - 2007-07-19 Corrected to fix a bug that displayed draft pages.
  • 1.1 - 2007-05-23 Corrected to fix a bug that didn’t display menus below the first level.
  • 1.0 - 2007-05-18 Updated to handle WordPress’s new method of storing pages.
  • 0.1 - 2006-10-04 Initial release.

Related Plugins

TAGS: , , , , , , , ,