SR-ChildPages Shortcode Plugin

This is my first WordPress plugin, which leverages the new WordPress 2.5 Shortcode API to make it quick and easy to include a list of child pages within a given page. This is something that I’ve found important to do in a few of my WordPress projects, but none of the other plugins really met my needs very well. But when WP2.5 introduced the Shortcode API, I knew I could get exactly what I wanted by creating a new Shortcode that lets an author gain access to the wp_list_pages() template tag.


You can always download the latest version of this plugin by clicking the image below.


For other versions, visit the SR-ChildPages entry in the WordPress Plugin Directory.


To start using the [childpages] shortcode, install it by uploading the sr-childpages folder to your wp-content/plugins directory and then activate the plugin through the ‘Plugins’ menu in WordPress. Then just start using the shortcode in your pages!


The basic shortcode to get a page list is [childpages]. Wherever you have a need to drop of a list of child pages for the page you’re currently authoring, just enter that code in either the Visual or HTML editor. The list that results will not be shown with a title, will be one level deep, will not exclude any child pages or authors, and will be sorted by page order and then by title.

To list the child pages with a title, use the enclosing form of the shortcode, like this:

[childpages]List Title[/childpages]

The text between the opening and closing shortcodes will be the title of the resulting list. It is being passed to the title_li attribute in the wp_list_pages() template tag.

To change the defaults used to format the list, pass the appropriate parameters in your shortcode, like this:

[childpages depth=2 sort_column=ID]

The parameters you provide are passed to wp_list_pages(). The following parameters are supported; usage details for these parameters can be found in the WordPress Codex.

  • depth
  • child_of
  • exclude
  • echo
  • authors
  • sort_column

A great thanks goes out to the WordPress community, who collectively strive to ensure that WordPress is an highly capable and easy-to-use web content management platform.

Leave a Reply