Descrizione
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:
ASCorDESC. Default:DESC, orASCwhenorderby="menu_order". - orderby: Field to order by. Default:
publish_date(maps todate). Also acceptspublished(maps todate),title,name,modified,menu_order,ID,rand,type, andauthor. Usemenu_orderto follow the Order numbers set under Page Attributes; pages with the same number sort by title. - displayimage: Show featured image (
yes|no). Also acceptsy,true,1, andon. 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
currentto 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”]
Here are our child pages:
[/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”]
Here are our child pages:
[/listchildpages]
Example 3: Target a specific parent page by ID and use medium-sized images:
[listchildpages parent=”123″ displayimage=”yes” size=”medium”]
Resources
[/listchildpages]
Example 4: Target a parent page by slug and show full-size featured images:
[listchildpages parent=”about/company” displayimage=”yes” size=”full”]
Team Sections
[/listchildpages]
Example 5: Follow the page order set under Page Attributes:
[listchildpages orderby=”menu_order”]
Chapters
[/listchildpages]
Example 6: Explicitly set the parent as the current page and use large images:
[listchildpages parent=”current” displayimage=”yes” size=”large”]
Subpages
[/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; usedknm_lcp_html.
Built by DK New Media. Visit Martech Zone for updates on this plugin and other marketing tools.
Screenshot
![The [listchildpages] shortcode in a Shortcode block, sorted by menu order with featured images.](https://ps.w.org/list-child-pages-shortcode/assets/screenshot-1.png?rev=3810474)
[listchildpages] shortcode in a Shortcode block, sorted by menu order with featured images.
Installazione
- In your WordPress admin, go to Plugins > Add New, search for “List Child Pages Shortcode”, and select Install Now. Or upload the
list-child-pages-shortcodefolder to/wp-content/plugins/. - Activate the plugin through the Plugins screen.
- Edit a parent page and add
[listchildpages]where the list should appear. - Optional: add an excerpt and featured image to each child page to show them in the list.
FAQ
-
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. Addorder="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 thatorderby="menu_order"without anorderattribute now sorts ascending, which matches the order shown in WordPress. -
What happens if I deactivate or uninstall the plugin?
-
Nothing in the database is stored or removed. The plugin has no settings, options, custom tables, or uninstall routine. Deactivate or delete it and your pages, excerpts, and featured images stay as they are. Shortcodes left in content will simply stop rendering until the plugin is activated again.
Recensioni
Contributi e sviluppo
“List Child Pages Shortcode” è un software open source. Le persone che hanno contribuito allo sviluppo di questo plugin sono indicate di seguito.
CollaboratoriTraduci “List Child Pages Shortcode” nella tua lingua.
Ti interessa lo sviluppo?
Esplora il codice segui il repository SVN, segui il log delle modifiche tramite RSS.
Changelog
1.6.0
- Author is now DK New Media. The plugin name, slug, folder, main file, and
[listchildpages]shortcode are unchanged. - Fix:
orderby="menu_order"now sorts ascending (the Page Attributes order) when noorderis given, with title as a tie-breaker for pages that share a number. - New:
[dknm_list_child_pages]alias for the shortcode. - New:
dknm_lcp_htmloutput filter. The 1.xdklcp/listchildpages/htmlfilter still runs and is marked deprecated. - Code now uses the
dknm_lcp_prefix. The olddklcp_function names remain as wrappers. - Tested up to WordPress 7.1 (7.1.5). Requires WordPress 4.6 or later.
1.5.1
- Align Version and Stable tag so WordPress.org serves the current code.
- Declare compatibility with WordPress 7.1.
- Raise minimum WordPress version to 3.1 (required by current APIs).
- Match the text domain to the plugin slug for translations.
- Keep default empty-state HTML out of the translatable string.
- Accept additional
orderbyvalues (rand,type,author) and thepublishedalias. - Accept
onas a truthydisplayimagevalue. - Query child page IDs so the shortcode does not take over the main Loop. Default markup is unchanged.
1.4.1
- Updated keywords for plugin
1.4.0
- Added
parentattribute to target a specific parent page by ID or slug. - Added
sizeattribute to choose featured image size. - Hardened shortcode sanitization and escaping for security.
- Backward-compatible with previous versions.
1.3.2
- Tested in latest versions of WordPress
1.3.1
- Tested in latest versions of WordPress
1.3.0
- Added an option to display the featured image for the page.
- Added class outputs for the ul and li tags in addition to the anchor text.
1.2.2
- Corrected an undeclared variable error.
1.2.1
- Added documentation on where you can see all of the order and orderby parameters.
1.2.0
- Added another shortcode option for the order. Default is DESC.
1.1.0
- Added another shortcode option for the orderby. Default is publish_date.
1.0.0
- Initial Release
