Shortcodes

List Pages Shortcode

The [list-pages], [sibling-pages], and [child-pages] shortcodes are used for easily displaying a list of pages.

Using the Shortcodes

The [display-posts] shortcode will not work for sites with the WordPress.com Business or higher plan using plugins. Various plugins offer similar functionality.

If you added shortcode before upgrading to the Business or higher plan, your code is still there. Once you install a Display Posts Shortcode plugin like this one, the codes will render the content again.


You can add a shortcode to any page or post using a shortcode block.

  • The [list-pages] shortcode will display all of your pages.
  • The [sibling-pages] shortcode will display all the sibling pages of your current page. Sibling pages are pages that share the same parent page.
  • The [child-pages] shortcode will display all the child pages of your current page. Child pages are pages that are under a parent page.

For more information on setting up child pages please check out this support doc.

↑ Table of Contents ↑

Customization Options

The list pages shortcodes are highly customizable. Below is a listing of all the available customizations options. When using one of the following customization options your shortcode should looking something like this, [shortcode option=’setting’]

Example:

[list-pages sort_column='post_date']

(Show all pages sorted by Post Date)

sort_column: sorts the list of Pages in a number of different ways. The default setting is sort alphabetically by Page title.

  • ‘post_title’ – Sort Pages alphabetically by title (Default).
  • ‘menu_order’ – Sort Pages by Page Order. Note the difference between Page Order and Page ID. The Page ID is a unique number assigned by WordPress to every post or page. The Page Order can be set by the user in the Pages -> Edit screen.
  • ‘post_date’ – Sort by creation time.
  • ‘post_modified’ – Sort by time last modified.
  • ‘ID’ – Sort by numeric Page ID.
  • ‘post_author’ – Sort by the Page author’s numeric ID.
  • ‘post_name’ – Sort alphabetically by Post slug.

sort_order: change the sort order of the list of Pages (either ascending or descending). The default is ascending.

  • ‘ASC’ – Sort from lowest to highest (Default).
  • ‘DESC’ – Sort from highest to lowest.

exclude: define a comma-separated list of Page IDs to be excluded. There is no default value.
(Example: ‘exclude=3,7,31’)

exclude_tree: define a comma-separated list of parent Page IDs to be excluded. Use this parameter to exclude a parent and all of that parent’s child Pages.
(Example: ‘exclude_tree=5’ would exclude the parent page with the Page ID of 5, and its child Pages)

include: only include certain Pages. Like exclude, this parameter takes a comma-separated list of Page IDs. There is no default value.

depth: this parameter controls how many levels in the hierarchy of pages are to be included. The default is 0 (display all pages, including all sub-pages).

  • 0 – Displays pages at any depth and arranges them hierarchically in nested lists (Default).
  • -1 – Displays pages at any depth and arranges them in a single, flat list.
  • 1 – Displays top-level Pages only.
  • 2, 3 … – Displays Pages to the given depth.

child_of: displays the sub-pages of a single Page only; uses the ID for a Page as the value. Note that the child_of parameter will also fetch “grandchildren” of the given ID, not just direct descendants. Default is 0 (displays all Pages).

show_date: display creation or last modified date next to each Page. The default is the null value (do not display dates).

  • – Display no date (Default).
  • ‘modified’ – Display the date last modified.
  • ‘xxx’ – Any value other than modified displays the date (post_date) the Page was first created.

date_format: controls the format of the Page date set by the show_date parameter. This parameter defaults to the date format configured in your WordPress options on the General -> Settings page. (Example: ‘l, F j, Y’)

For more information on formatting your date please see the date format page on the php web site.

title_li: set the text and style of the Page list’s heading. If passed a null or empty value (”), no heading is displayed, and the list will not be wrapped with <ul>, </ul> tags. Defaults to (”).

link_before: sets the text or html that precedes the link text inside <a> tag.

link_after: sets the text or html that follows the link text inside <a> tag.

authors: only include Pages authored by the authors in this comma-separated list of author IDs. If no authors are specified, all authors are included.

offset: the number of Pages to skip before collecting the set of Pages. Default is no offset.

post_status: a comma-separated list of all post status types to return. (Example: ‘publish,private’)

Still confused?

Contact support.

Not quite what you're looking for?

Get Help