sandywp / plugins / list-pages-shortcode

List Pages Shortcode

4.9 out of 5 stars. 4.9 14 reviews

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

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

v1.7.7 5,000+ installs WP 4.4.0+

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

About this plugin

Introduces the [list-pages], [sibling-pages] and [child-pages] shortcodes for easily displaying a list of pages within a post or page. Both shortcodes accept all parameters that you can pass to the wp_list_pages() function with the addition of a class parameter.

Example Usage

List pages sorted by title

[list-pages sort_column="post_title"]

List pages but exclude certain IDs and set the class of the list to “my-page-list”

[list-pages exclude="17,38" class="my-page-list"]

Show excerpt (for pages excerpt support will need adding manually or via the Page Excerpt plugin)

[list-pages excerpt="1"]

List the current page’s children, but only show the top level

[child-pages depth="1"]

List the current page’s siblings and their subpages

[sibling-pages depth="2"]

Default Arguments

The default values are the same as for the wp_list_pages() function except for title_li which defaults to nothing. If a class is not specified, a default class of either “list-pages”, “sibling-pages” or “child-pages” is given to the UL tag. In addition, the echo parameter has no effect.

In addition to the wp_list_pages() arguments, you can also specify:

  • list_type (string) List tag. Defaults to <ul>.
  • exclude_current_page (int) Exclude the current page. Defaults to 0.
  • excerpt (int) Show the page excerpt. Defaults to 0.

Questions

How do I include a page excerpt?

Firstly you will need to add support for excerpt for your pages. You can either you this by using the add_post_type_support() function or using a plugin like Page Excerpt.

You can also use the ‘list_pages_shortcode_excerpt’ filter to return or customize the excerpt for specific pages. The following example:

You can then include the excerpt via your shortcode.
[list-pages excerpt=”1″]

4.9

14 reviews

  • 5 ★ 12
  • 4 ★ 2
  • 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.

  • Protect the Children!

    4.9 · 1K+ installs

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

  • Child Pages Block

    3.3 · 90+ installs

    Gutenberg block gets child pages list of specific page

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.