sandywp / plugins / list-child-pages-shortcode

List Child Pages Shortcode

5.0 out of 5 stars. 5.0 3 reviews

List a page's child pages anywhere with one shortcode, with optional featured images, excerpts, custom ordering, and CSS classes.

Launch a sandbox with this plugin → No signup.
Ready in seconds.

v1.6.3 600+ installs WP 4.6+ PHP 7.4+

your-sandbox.sandywp.com/wp-admin
List Child Pages Shortcode running inside a SandyWP sandbox

What you get inside

2 screens
  • The [listchildpages] shortcode in a Shortcode block, sorted by menu order with featured images.

  • The published list of child pages with featured images and excerpts (Twenty Twenty-Five, with a few lines of theme CSS for the thumbnails).

About this plugin

List Child Pages Shortcode adds a [listchildpages] shortcode that lists the child pages of the current page, or of any page you choose, as a simple linked list. Each item can show the page’s featured image and excerpt.

  • Works in any page, post, widget, or template that renders shortcodes.
  • Choose the parent by ID, slug/path, or the current page.
  • Sort by date, title, menu order (the Order field under Page Attributes), and more.
  • Optional featured images at any registered image size.
  • Add your own CSS classes to the list, items, and links.
  • No settings, no database tables, no external services, no tracking.

Usage

The shortcode is [listchildpages]...[/listchildpages]. [dknm_list_child_pages] works the same way. It accepts several attributes:

  • ifempty: Message or HTML to show if no child pages exist.
  • order: ASC or DESC. Default: DESC, or ASC when orderby="menu_order".
  • orderby: Field to order by. Default: publish_date (maps to date). Also accepts published (maps to date), title, name, modified, menu_order, ID, rand, type, and author. Use menu_order to follow the Order numbers set under Page Attributes; pages with the same number sort by title.
  • displayimage: Show featured image (yes|no). Also accepts y, true, 1, and on. Default: no.
  • align: CSS class to apply to the image (alignleft, alignright, etc.).
  • ulclass, liclass, aclass: CSS classes for the list, list items, and links.
  • parent: ID, slug/path, or current to choose the parent page. Default: current.
  • size: Image size for thumbnails (thumbnail, medium, large, full, or custom size). Default: thumbnail.

Examples:

Example 1: Order the child pages by publish date in descending order:

[listchildpages aclass="" ifempty="No child pages" orderby="publish_date" order="desc" displayimage="no"]
<h3>Here are our child pages:</h3>
[/listchildpages]

Example 2: Order the child pages by title in ascending order with the page’s featured image aligned left:

[listchildpages orderby="title" order="asc" displayimage="yes" align="alignleft"]
<h3>Here are our child pages:</h3>
[/listchildpages]

Example 3: Target a specific parent page by ID and use medium-sized images:

[listchildpages parent="123" displayimage="yes" size="medium"]
<h3>Resources</h3>
[/listchildpages]

Example 4: Target a parent page by slug and show full-size featured images:

[listchildpages parent="about/company" displayimage="yes" size="full"]
<h3>Team Sections</h3>
[/listchildpages]

Example 5: Follow the page order set under Page Attributes:

[listchildpages orderby="menu_order"]
<h3>Chapters</h3>
[/listchildpages]

Example 6: Explicitly set the parent as the current page and use large images:

[listchildpages parent="current" displayimage="yes" size="large"]
<h3>Subpages</h3>
[/listchildpages]

Developer filters

  • dknm_lcp_html – filter the final HTML. Receives the HTML, the parent page ID, and the normalized attributes.
  • shortcode_atts_listchildpages – the standard WordPress filter for the shortcode’s attributes.
  • dklcp/listchildpages/html – the 1.x output filter. It still runs but is deprecated; use dknm_lcp_html.

Built by DK New Media. Visit Martech Zone for updates on this plugin and other marketing tools.

Questions

How can I add a description for each child page?

Edit the child page and you’ll find an excerpt section where you can enter a description that will be published on the list.

How can I enable featured images on my site?

Within your functions.php file, look for the add_theme_support post-thumbnails line and add page to the array. Or if you don’t have that line, you can just add it:

add_theme_support( 'post-thumbnails', array( 'post', 'page' ) );

How can I modify the output?

There are additional class fields for the unordered list tag (ulclass), list item tag (liclass), and the anchor tag (aclass). You can modify the output utilizing your theme’s CSS.

How do I list child pages in my own order?

Set the Order number under Page Attributes on each child page (1, 2, 3…), then use [listchildpages orderby="menu_order"]. Since 1.6.0 this sorts lowest number first. Add order="desc" to reverse it.

I updated to 1.6.0. Do I need to change my shortcodes?

No. [listchildpages] and every attribute work as before. The only change in output is that orderby="menu_order" without an order attribute now sorts ascending, which matches the order shown in WordPress.

What happens if I deactivate or uninstall the plugin?

The plugin stores nothing in the database. An uninstall.php file defensively removes any leftover dknm_lcp_ or legacy dklcp_ options or transients if they were ever created. Your pages, excerpts, and featured images are not changed. Shortcodes left in content will simply stop rendering until the plugin is activated again.

5.0

3 reviews

  • 5 ★ 3
  • 4 ★ 0
  • 3 ★ 0
  • 2 ★ 0
  • 1 ★ 0

Ratings come from WordPress.org. SandyWP does not collect its own reviews.

sandywp / also on the shelf

Try another plugin

  • CC Child Pages

    4.9 · 9K+ installs

    Display WordPress child pages in a responsive grid or list using a shortcode, Gutenberg block or Elementor widget.

  • List Pages Shortcode

    4.9 · 5K+ installs

    Introduces the [list-pages], [sibling-pages] and [child-pages] shortcodes for easily displaying a list of pages within a post or…

  • Protect the Children!

    4.9 · 1K+ installs

    Easily password protect the child pages/posts of a post/page that is password protected.

Spin up a real WordPress site in seconds.

Test plugins, build a demo, hand a client a link — then squash it and start again. No local setup, no Docker.