What Are Subpages and Why Would I Use Them?

What Are Subpages and Why Would I Use Them?

WordPress has a built-in subpage feature allowing you to organize pages in a parent-child-sibling tree, and place them on the menu.

That begs a couple questions… Why would I use subpages? What plugins are available to assist and enhance them?

That’s exactly what we’ll be addressing in this article.

Continue reading, or jump ahead using these links:

Why Use Subpages?

The best use of subpages is to organize hierarchical content into a hierarchy or outline.

The subpage feature should not be used to paginate a long page. If you didn’t already know, James thinks Pagination Is Evil, and that’s not what I’m talking about.

If you simply have a long page, use the nextpage tag, which paginates a long page or post.

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 WPMUDEV.com, 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 Parent for the page, making the page we’re working on a subpage or “child” of “CV”.

The other “Exhibition” pages listed under are parent (“CV”) are also subpages, and are the “siblings” of the “Celine Raphel-Leygues” page.

Page attributes

Once a subpage has been created, it can be added to the menu by hand. Or better yet, by using a plugin to Automatically Add WordPress Submenu to Parent Menu for Pages, giving this result:

Main dropdown menu, parent-child-siblings.
Subpages in the main menu dropdown.

Using a Widget to Place a Subpage Menu in a Sidebar

In the following example, I first used the Subpages Extended plugin to create a subpage menu in the sidebar.

Subpages Extended plugin in the Page editor.
Subpages Extended plugin in the Page editor.

Then I used the Custom Sidebars plugin to display this menu on the parent page and its subpages only.

FREE EBOOK
Your step-by-step roadmap to a profitable web dev business. From landing more clients to scaling like crazy.

By downloading this ebook I consent to occasionally receive emails from WPMU DEV.
We keep your email 100% private and do not spam.

FREE EBOOK
Plan, build, and launch your next WP site without a hitch. Our checklist makes the process easy and repeatable.

By downloading this ebook I consent to occasionally receive emails from WPMU DEV.
We keep your email 100% private and do not spam.

Subpage menu in sidebar created with the Subpages Extended and Custom Sidebars plugins.
Subpage menu in sidebar created with the Subpages Extended and Custom Sidebars plugins.

The Subpages Extended plugin creates a subpages navigation (table of contents) on your pages and your sidebar.

The widget option is so easy to use, and the shortcode option gives you more control for manipulating your subpages menus.

Here is the basic shortcode usage:

[subpages exceptme=”true” childof=”253″]

The Custom Sidebars plugin is a flexible widget area manager that allows you to replace sidebars—and other widget areas—on your site. (Custom Sidebars works with the classic widgets screen that was used in WordPress before version 5.8. To use it with version 5.8 and above, you’ll need to install the official Classic Widgets plugin).

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 plugin to place navigation at the top of each subpage and the parent page.

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.

This is the shortcode I used:

[sibling-pages exclude="150"]

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

One other plugin I made use of was Catch Ids—making it easier to determine the pageid’s for my parent page and subpages.

Though some of these plugins are a year or more out from updates, we tested them (during the 2022 rewrite of this post), and they still worked as expected.

Wrapping Up

So there you have it. A neat and tidy way to implement subpages and widgets, using a few handy plugins, and a bit of shortcode.

Editor’s Note: This post has been updated for accuracy and relevancy.
[Originally Published: September 2013 / Revised: April 2022]

Do you use subpages? If so, have you implemented any plugins that made them even more valuable? Let us know in the comments below.

Tags:

Hassan Akhtar Hassan Akhtar is the lead dev for Smush and HummingBird. In his free time he enjoys writing about his development adventures at WPGurus.net.

Janette Burhans Janette Burhans is a content creator at WPMU DEV, who writes blog articles and the weekly WhiP & Roundup emails. Her professional career as an author and artist spans over two decades, half of those in the world of WordPress. Her writing has been featured in Glamour magazine, and her personal blog, Platinum Pink. Connect with Janette on Twitter.