NASA Logo, National Aeronautics and Space Administration

NASA GRC WordPress Users Guide

Subpage View Plugin Allows Easy, Dynamic Child Page Listings

The Subpage View plug-in, installed on GRC WordPress sites, uses WordPress shortcode [external]  functionality to easily list sub pages (children of a parent page, a.k.a. pages that appear under a page in the navigation)  in any Page or Post.

This shortcode can be placed anywhere in your text (preferably on its own, separate line) in either the visual or HTML editor, and it displays the pages as a bulleted list. Since this shortcode is a function, it will dynamically update the list as you update your Page arrangement (by adding Pages in the navigation, changing Page order, etc.)

A Few Notes Before We Show Some Examples

  1. Shortcode: A special command that WordPress understands and processes, which you place in brackets like this “[ something ]” in the Visual or HTML editor in order to tell WordPress to do something.
  2. Note: There should be no space after the opening bracket or before the closing bracket when you actually use the shortcode. The space is added in the examples below so you can actually see the shortcode used. Be sure to delete these extra spaces if you cut and paste the code below.

Why Use This?

The simplest example is below, say, if you need to list all underlying projects Pages on the Projects page without having to update the list as you add new projects, like so:

Our Current Projects

  • Project ABC
  • Project 123
  • Project Third
  • … List dynamically updates as you update pages, thereby saving you site maintenance time.

Common Usage Examples

[ subpage-view ]
Lists all subpages of the page the shortcode is placed on.

Looks like this:

[ subpage-view depth="1" ]
List subpages of only the first level. A depth of “2″ would go two levels deep.

Looks like this:

[ subpage-view depth="1" title_li="My Sub Pages" ]
One level deep and puts the list under a “My Sub Pages:” list item.

Looks like this:

[ subpage-view depth="1" child_of="203" ]
List subpages, one level deep, for the page with ID#203. (You can find the ID number of a Page on the Administration page: Pages > Edit)

Looks like this:

Also: You can exclude any page by simply adding exclude=”#,#” inside the shortcode, where the # are the numbers of the Page ID, separated by a comma. For example, using the example above, [ subpage-view child_of="203" exclude="297" ].

Looking for more variables? Consult the WordPress.org documentation on the wp_list_pages function.

NASA Logo - nasa.gov