Home Plugins classy wp list pages
Plugin Name: Classy wp_list_pages logo

Plugin Name: Classy wp_list_pages

by Alex Dunae on WordPress.org

Adds a uniqe class or ID attribute to each LI tag generated by wp_list_pages() and wp_nav_menu() allowing them to be individually styled with CSS.

(0)

This plugin adds classes or IDs (your choice) to the LI tags generated by WordPress’ wp_list_pages() and wp_nav_menu() functions.

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

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

For example,

  • /about/ could have the class about.
  • /about/faq/ could have the class about_faq.

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,

  • / could have the class pg_frontpage.

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

Sample output




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.

You can also specify a class to add to the first and last items in a list.

Pretty straight forward…

Contact and Credits

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

Active installations90+
Weekly downloads
24-14.29%
Version1.4,0
Last updated2/4/2011
WordPress version2.2
Tested up to3.0.5
Tags
classcssidlinksstyle