WordPress plugin: Zelig Dropdown Pages

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.

INSTRUCTIONS:

  1. Download the zip file (current version is 1.1 of september 18, 2006).
  2. Extract the zelig-dropdown-pages.php file into the plugins directory in your WordPress installation (wp-content/plugins).
  3. Log in to WordPress administration. Go to the Plugins page and Activate this plugin.
  4. 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.

Parameter Values Description Default
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_column post_title
menu_order
post_date
post_modified
ID
post_author
post_name
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)
post_title
sort_order ASC
DESC
sort order for options:
ASC (sort from lowest to highest )
DESC (sort from highest to lowest)
ASC
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
(no limit)

EXAMPLES:

<?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.

NOTES:

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!).

CHANGE LOG:

  • 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.
Informatica, Permalink

Abbiamo 16 commenti a questo articolo

  1. marcus dice:

    thanks very much! .)

    works like a charm.

  2. marcus dice:

    question:

    how do i add an »selected« status to the option tag that refers to the actual site?

    thanks in advance

    marcus

  3. marcus dice:

    i mean the current page. sorry.

    m

  4. marcus dice:

    figured it out. :)

    m

  5. Ana dice:

    Is there any way you can use two instances of this? I’d like to divide my pages up with two lists (using the “exclude” category on both) but it seems in the second instance, while the menu shows up, the links don’t go anywhere.

  6. Zelig dice:

    I promise I’ll think about it, Ana, but not in short time. I’m a little busy now… :)

  7. Zelig dice:

    Rilasciata una nuova versione del plugin (1.1)
    Plugin’s new version released (1.1)

    @Ana: get this one and it’ll work as you want!

  8. Pingback: Texto.de

  9. Mery dice:

    Ciao, premessa che è da poco tempo che sono alle prese con wp.
    La mia necessità è di creare un menù che mi visualizzi solo i figli della pagina che seleziono, e nasconda i figli delle altre pagine, pur visualizzando il nodo genitore.
    Mi sfugge qualcosa. come posso ottenere un effetto simile combinando i parametri?????
    …per ora riesco o a stampare i genitori, o astampare i figli!

    Come supero questo problema generazionale?????

    Qualsiasi suggerimento è gradito.

    PS: grazie zelig:cheers:

  10. Zelig dice:

    Se ho capito bene quello che vuoi fare, Mery, (un elenco contente sia le pagine “principali” che i figli di quella corrente) temo proprio che non sia possibile con i parametri attualmente disponibili. Terrò presente la richiesta per una futura versione del plugin!

  11. Dustin dice:

    Hi,

    Nie job here! Would would I make this work for posts instead of pages?
    I can pay you if it helps.

  12. Zelig dice:

    Dustin, you’ll get a HUGE list if you put all posts inside, don’t you think? What dou you want to do exactly?

  13. Mike dice:

    Nice plugin, but it only works if you are using the default permalink structure. How would I fix it if my permalink structure was http://blogurl/%postname% ?

  14. Mike dice:

    I resolved the problem. Somehow my .htaccess file got deleted when I installed your plugin. It works fine now with different permalink structures.

  15. Alphawolf dice:

    Hey,

    thanks for your neat plugin. Was what I’ve been searching for. :-)

  16. Pingback: [BLOCKED BY STBV] Statische Seiten in einem Drop Down Menü- WP Plugin von Zelic

Lascia un Commento

L'indirizzo email non verrà pubblicato. I campi obbligatori sono contrassegnati *

:smile: :grin: :mrgreen: :wink: :neutral: :sad: :cry: :eek: :confused: :cool: :lol: :razz: :oops: :mad: :evil: :twisted: :roll: :surprised: :!: :?: :idea: :arrow: :clap: :dance: :doh: :drool: :eh: :hand: :liar: :naughty: :pray: :shhh: :shifty: :sick: :silenced: :snooty: :think: :wall: :whistle: :love: :censored: :crazy: :food: :thumbup: :ciao: :cheers: :winky: :kiss: :rotfl: :ninja: