List Child Pages Shortcode

Have you ever wanted to add something simple to a page that will allow you to list the child pages of the current page? Well if so, meet the List Child Pages Shortocde.

Today I have been working on adding some information on this site about my WordPress plugins. During the process it became clear that I wanted to list the child pages of my main plugins page on the plugins page to introduce each plugin before being able to click to view more information about each plugin. I also wanted to show an associated image with each.

To do this I developed a really simple little plugin in order to create a shortcode to do just that. Below is what I have come up with:

https://gist.github.com/wpmark/9076534

In your page you simply enter the following shortcode in order to output the child pages list. You can change the images parameter to either true or false to show or hide the child pages featured image.

https://gist.github.com/wpmark/9076729

Obviously you will need to style the resulting HTML in your themes stylesheet.

Leave a Reply

Your email address will not be published. Required fields are marked *