We've rebuilt the hierarchy of sites for several of our WordPress clients, and one of the things we attempt to do is organize the information efficiently. To do this, we often want to create a master page and include a menu that automatically lists all of the pages below it. A list of child pages, or subpages. Unfortunately, there's no inherent function or feature to do this within WordPress, so we developed a WordPress List Subpages shortcode to add to the clients' theme's functions.php file.
Usage is pretty simple:
No child pages
- aclass – If you'd like to apply a class in your unordered list, just enter it here.
- ifempty – If there's no child pages, you can insert text. This comes in handy if it's a list of job openings… you could enter “No current openings.”
- content – This is the content that's displayed before the unordered list.
Additionally, if you'd like a short excerpt describing each page, the plugin enables excerpts on pages so that you can edit that content on the page's settings.
I finally got around to pushing the code into a plugin to make it easier to install and utilize, and the List Child Pages Shortcode plugin was approved by WordPress today! Please download and install it – if you like it provide a review!