WordPress: How to List Child Pages Using A Shortcode

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 achieve this, we often want to create a master page that includes a menu automatically listing the pages below it: a list of child pages, or subpages.
WordPress does not include that as a built-in feature, so we published a shortcode as a free plugin. Install List Child Pages Shortcode from the WordPress plugin directory, then drop [listchildpages] into any page, post, or widget. The plugin stores no settings and writes nothing to the database, so deactivating or deleting it leaves your pages, excerpts, and featured images untouched.
How to Use the Shortcode
Insert the shortcode into the content of the parent page where the list should appear. Enclosed content between the opening and closing tags is printed above the list (a heading is typical). Here is a fully populated example:
[listchildpages ifempty="No child pages found" order="ASC" orderby="title" ulclass="custom-ul-class" liclass="custom-li-class" aclass="custom-a-class" displayimage="yes" align="aligncenter" parent="current" size="thumbnail"]
<h3>Here are our child pages:</h3>
[/listchildpages] Shortcode Attributes
Every attribute is optional. Defaults keep existing lists looking the same after you update the plugin. Truthy values for displayimage are y, yes, t, true, 1, and on.
- ifempty: Message or HTML shown when the parent has no child pages. Default: a short “No Records” paragraph.
- order:
ASCorDESC. Default:DESC. - orderby: Field used to sort children. Default:
publish_date(mapped todate). Also acceptspublished(same mapping),title,name,modified,menu_order,ID,rand,type, andauthor. - displayimage: Show each child’s featured image. Default:
no. - align: CSS class on the image (
alignleft,alignright,aligncenter). Default:alignleft. - size: Image size when
displayimageis on:thumbnail,medium,large,full, or a registered custom size. Default:thumbnail. - ulclass, liclass, aclass: Extra CSS classes for the list, each item, and each link. Empty values are omitted from the markup.
- parent: Which page’s children to list. Use a numeric ID, a slug or path (
about/company), orcurrent/self. Default:current.
The query only loads child page IDs, so the shortcode is safe to use outside the main Loop. It does not take over the current post. Class names are sanitized. Empty-state HTML and excerpts are passed through WordPress’s allowed-HTML filter.
Examples
Order children by publish date, newest first:
[listchildpages ifempty="No child pages" orderby="publish_date" order="desc" displayimage="no"]
<h3>Here are our child pages:</h3>
[/listchildpages] Order by title, show featured images on the left:
[listchildpages orderby="title" order="asc" displayimage="yes" align="alignleft"]
<h3>Here are our child pages:</h3>
[/listchildpages] Target a parent by ID and use medium images:
[listchildpages parent="123" displayimage="yes" size="medium"]
<h3>Resources</h3>
[/listchildpages] Target a parent by slug and use full-size images:
[listchildpages parent="about/company" displayimage="yes" size="full"]
<h3>Team Sections</h3>
[/listchildpages] Install the Plugin
From your WordPress dashboard, open Plugins, Add Plugin, and search for List Child Pages Shortcode. Install and activate it. You can also download it from the WordPress.org plugin page (version 1.5.1, tested through WordPress 7.1.1) and upload the zip. Source for the plugin lives on GitHub.
- Install and activate List Child Pages Shortcode.
- Edit the parent page (or any post) where the list should appear.
- Add the
[listchildpages]shortcode, with attributes if you need them. - Publish or update the page.
Page Excerpts and Featured Images
If you want a short description after each title, edit the child page and fill in the excerpt. The plugin turns excerpt support on for pages automatically. Featured images require your theme to support post thumbnails on pages. If they are missing, add this to the theme’s functions.php:
add_theme_support( 'post-thumbnails', array( 'post', 'page' ) ); Deactivating or uninstalling the plugin does not delete pages, excerpts, featured images, or any options. It never registered settings. Shortcodes left in content stop rendering until you activate the plugin again.
View List Child Pages Shortcode in the WordPress Plugin Repository







