
List Child Pages Shortcode
v1.6.3Douglas Karr · 2018年7月12日 上架
List a page's child pages anywhere with one shortcode, with optional featured images, excerpts, custom ordering, and CSS classes.
- 正在使用
- 600+
- 评分
- 5.0 / 5
- 累计下载
- 1.1 万
- 最近更新
- 2026年11月22日
贡献者
截图
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"]
<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; usedknm_lcp_html.
Built by DK New Media. Visit Martech Zone for updates on this plugin and other marketing tools.
![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)
