Back to Support Content and Media List Pages Shortcode

List Pages Shortcode

Use the [list-pages], [sibling-pages], and [child-pages] shortcodes to display a list of pages.

Shortcode Alternatives

There is less of a need for shortcodes in the modern WordPress experience. To display pages on your site, consider the Blog Posts or Query Loop blocks, which both support pages.

Using the Shortcodes

The available shortcodes are:

If you have a plugin-enabled site, you must install the Display Posts Shortcode plugin to ensure the shortcodes work.

Customization Options

The list-pages shortcodes are highly customizable. Below is a listing of all the available customization options.

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

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).

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. The 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).

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 in Settings → General. (Example: ‘l, F j, Y’)

For more information on formatting your date please see the date format page on the PHP website.

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. The default is no offset.

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

How to Customize a Shortcode

When using one of the above customization options, your shortcode should look something like this: [shortcode option='setting']

Example:

[list-pages sort_column='post_date']

(This will show all pages sorted by post date)

Was this guide helpful for you?

Not quite what you're looking for? Get Help!

Copied to clipboard!