What are subpages and why would I use them?

Word-Press has a built-in subpage feature allowing you to organize pages in a parent-child-sibling tree and place them on the menu. What are sub-pages, why would I use them, and what plug-ins are available to use and enhance them?

Why use subpages?

The subpage feature should not be used to paginate a long page. If you simply have a long  page, use the  nextpage tag which paginates a long page or post. Please note that Thord thinks Pagination Is Evil and no one wants to incur the wrath of Thord! That’s not what I’m talking about.

The best use of subpages is to organize hierarchical content into a hierarchy or outline. We can already do this simply by using the HTML heading tags (h1, h2, h3, etc.) as is done in most items posted here at WPMU.org and in this post, but subpages add the additional abilities to place them on the menu, in a sidebar menu, and provide navigation between them.

Creating subpages and adding to the main menu

Before we can use any of the advanced subpage features, let’s see how to create subpages. When adding or editing a page, in the right hand-column, under the heading “Page Attributes”, select the Parent for the page, making the page we’re working on a subpage or “child” of “CV”. The other pages listed under “CV” are also subpages and are the “siblings” of our page.

Setting subpage parent in page attributes

Once a subpage has been created, it can be added to the menu by hand, or better yet use a plug-in to Automatically Add WordPress Submenu to Parent Menu for Pages, giving this result.

Subpages in main menu dropdown
Subpages in main menu dropdown

 Using a widget to place a subpage menu in a sidebar

In the following example, I used the Subpages Extended plugin to create a subpage menu in the sidebar and then used the Dynamic Widgets plugin so that this menu would only display on the Parent page and its subpages.

Subpage menu in sidebar created using the Subpages Extended and Dynamic Widgets plugins
Subpage menu in sidebar created using the Subpages Extended and Dynamic Widgets plugins

Using a plugin for improved navigation on each subpage

When using the nextpage WordPress tag, the navigation inserted at the bottom of each paginated page simply lists the paginated pages as numbers (i.e. 1 2 3 4) with each page number linked appropriately. This works fine for breaking up a long page, but not when we want to organize the information into subpages to gain the benefits of the subpage feature and plugins. (See  Pagination: How to Split a WordPress Post into Multiple Pages tutorial.)

I used the List Pages Shortcodes plug-in to place navigation at the top of each supage and the parent page.

This is the shortcode I used:

[sibling-pages exclude="150"]

Here’s what it looks like on one of the subpages:

Subpage navigation on subpage using the List Pages Shortcodes plugin
Subpage navigation on subpage using the List Pages Shortcodes plugin

I chose to exclude a link to the subpage currently being displayed from these links. In this example  “Exhibitions 2010 – 2012″ is pageid 150 and is excluded in the shortcode.

On last thing: I used the Catch Ids plugin to make it easier to determine the pageid’s for my parent page and subpages.

Tags

Comments (2)

    • Thank you. This is my first post here at WPMU.

      There’s another “trick” with subpages I hope to write about soon. Since you’re already using them, I’ll give you a quick highlight: You don’t actually have to use the parent page on your site. You can use the custom link menu option to point to one of the subpages. I use this when I want the menu to be listed one way, but I don’t really want that page on the site. If you take a look at the CV menu item at http://www.celineraphaelleygues.com, you’ll see this in use. (I manipulated the menu to produce the examples for this article.)

Participate