Yes, another plugin from the “Zelig Dropdown” series!
This one shows the pages links in the sidebar as a simple and small dropdown list (select box). This plugin should replace the WP standard wp_list_pages() function.
- Download the zip file (current version is 1.1 of september 18, 2006).
- Extract the zelig-dropdown-pages.php file into the plugins directory in your WordPress installation (wp-content/plugins).
- Log in to WordPress administration. Go to the Plugins page and Activate this plugin.
- Put this code somewere in your template page, outside the loop (usually in sidebar):
<?php zelig_dropdown_pages(); ?>
The zelig_dropdown_pages() function has some optional parameters you can pass, and most of them are the same as in wp_list_pages() function.
|child_of||integer||display only the subpages of the page; use the numeric ID for a page as the value||0
(display all pages)
|sort pages list by one of the following options:
post_title (sort alphabetically by page/post title)
menu_order (sort by page order specified as part of your page entry in Write -> Pages)
post_date (sort by creation time)
post_modified (sort by time last modified)
ID (sort by numeric page ID)
post_author (sort by author numeric ID)
post_name (sort alphabetically by post slug)
|sort order for options:
ASC (sort from lowest to highest )
DESC (sort from highest to lowest)
|exclude||integer or comma separated integers list||list of page numeric IDs to be excluded from the list. Page numbers must be in ascending order|
|depth||integer||numeric value for how many levels of hierarchy (sub-pages) to display. set to 0 display all pages, -1 shows no child pages. This parameter doesn’t seem to work as expected, just like in the standard wp_list_pages() function: every value different from 0 excludes all child pages from the list…||0
(display all pages)
|title_li||string||text appearing in the list box when it’s closed||“Pages” (or corresponding localized text)|
|boxwidth||integer||width size (in pixel) of the list box. If you don’t use this parameter or if you set it to zero, the list box will assume the width of the longest page name it contains. This could easily mess up your template, if you have long names and/or narrow sidebar. If you set a width value, longer names may be truncated at that point on some browsers (IE6…)||0
<?php zelig_dropdown_pages('boxwidth=120'); ?>
Set the width size of the list box to 120 pixels.
<?php zelig_dropdown_pages('sort_column=menu_order&sort_order=DESC'); ?>
Shows the list in the opposite (DESC) order specified in administration panel.
<?php zelig_dropdown_pages(child_of=50&exclude55,62'); ?>
Shows only subpages of page 50, but excluding pages 55 and 62.
<?php zelig_dropdown_pages(depth=1&title_li=Sezione 1'); ?>
Shows only first level of subpages and set “Section 1″ as list title.
The output code is valid XHTML Strict.
Tested with WordPress 2.0.4 only. At present I can’t say if it works with previous versions (but I will apreciate if someone could try it and let me know!).
- Version 1.1 (september 18, 2006): a little upgrade lets you use more than one istance of the function in the same page, for example to split your pages in two or more lists using the “exclude” option.