Zelig Planet

Niente va mai così male che non possa andar peggio. (Murphy)

Home Page - Blog - Informazioni

Archivio

cerca un articolo inserendo una o più parole qui sotto:

oppure seleziona un mese dall'elenco:

oppure scegli una categoria di articoli:

oppure visualizza la pagina dell'archivio

Misc

Feed RSS 0.92 Feed RSS 2.0 RSS 2.0 comm. Feed Atom 0.3 XHTML valido CSS valido Sottoscrivi con Bloglines

Powered by
WordPress 2.0.7

Wordpress plugin: Zelig Dropdown Pages

Venerdì 25 Agosto 2006 by Zelig

english italian Articolo multilingue / Multilanguage post

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=Section 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.

Look here for all the Wordpress plugins from Zelig!

Ci sono 15 commenti a questo articolo

  1. Gravatar Commento di marcus   (4 commenti)

    thanks very much! .)

    works like a charm.

  2. Gravatar Commento di marcus   (4 commenti)

    question:

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

    thanks in advance

    marcus

  3. Gravatar Commento di marcus   (4 commenti)

    i mean the current page. sorry.

    m

  4. Gravatar Commento di marcus   (4 commenti)

    figured it out. :)

    m

  5. Gravatar Commento di Ana   (1 commento)

    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. Gravatar Commento di Zelig   (428 commenti)

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

  7. Gravatar Commento di Zelig   (428 commenti)

    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. Trackback da Texto.de
  9. Gravatar Commento di Mery   (1 commento)

    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. Gravatar Commento di Zelig   (428 commenti)

    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. Gravatar Commento di Dustin   (1 commento)

    Hi,

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

  12. Gravatar Commento di Zelig   (428 commenti)

    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. Gravatar Commento di Mike   (2 commenti)

    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. Gravatar Commento di Mike   (2 commenti)

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

  15. Gravatar Commento di Alphawolf   (1 commento)

    Hey,

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

Scrivi un commento

:) :D :( :o 8O :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: :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:

  

NOTE SUI COMMENTI:

  • Se non avete mai scritto nulla su questo blog, sappiate che il vostro primo commento dovrà essere approvato manualmente dall'amministratore e quindi non comparirà subito sul sito.
  • E' possibile usare dei tag HTML nel testo del commento, ma solamente quelli validi come XHTML "Strict" verranno accettati, quindi il risultato potrebbe anche essere un po' diverso dal previsto... nel dubbio, usate il testo semplice!
  • Questo blog supporta i "Gravatar": utilizzate lo stesso indirizzo e-mail con cui vi siete registrati e la vostra immagine comparirà automaticamente nel vostro commento. Se non avete ancora un gravatar, registratevi subito su www.gravatar.com!
  • La vostra e-mail, che comunque resterà sempre riservata, serve anche per il conteggio del totale dei vostri commenti e per inviarvi, se ne fate richiesta, gli avvisi di eventuali nuovi commenti.

Copyright © 1997-2008 Corrado "Zelig". Tutti i diritti riservati (vedi note legali)

NB: state visualizzando questo sito nella versione ottimizzata per dispositivi portatili (cellulari, palmari, ecc.) oppure con un browser "datato" che non consente di visualizzare correttamente i fogli di stile (CSS). I contenuti del sito sono comunque gli stessi e le differenze riguardano solamente l'aspetto estetico, che sarebbe molto più "piacevole" se visualizzato con un browser più recente!