code.dunae.ca

Classy wp_list_pages WordPress Plugin v1.2.2

This plugin adds classes or IDs (your choice) to the LI tags generated by WordPress' wp_list_pages() function.

I found it very frustrating to style the output of wp_list_pages() without having access to these attributes. This plugin allows you to style the output of wp_list_pages() with CSS.

The class name or ID is derived from the URL of the page.

For example,

If a page does not have a URL (e.g. your front page) the plugin will set the class or id(depending on what you selected) to frontpage, adding whatever prefix you requested.

For example,

Existing classes (e.g. page_item or current) are left untouched.

Time for an experiment. Updates to plugins, gems and other code will be announced at http://twitter.com/TheCHANGELOG. Follow along so you can receive updates without having to check back. You can also subscribe to the Atom feed.

Configuration

Using the Classy wp_list_pages tab in the options panel you can choose whether you want to use IDs or classes, set the token separator and add an optional token prefix.

Pretty straight forward…

Installation and usage

Download wp_classy_list_pages.zip (version 1.2.2) and unzip it in your WordPress plugins directory. Activate it and you’re done.

Contact and credits

Written by Alex Dunae (dunae.ca, e-mail 'code' at the same domain), 2007-09.

Thanks to Dave Penfold for catching the front page bug, leading to the 1.1.1 release.

Thanks to Joen Asmussen for catching a different front page bug, leading to the 1.2.2 release.