In WordPress, pages are arranged in a hierarchical manner, meaning that you can create a page and a subpage. A subpage is also known as a child page. When creating a page on WordPress, by default, the page is usually standalone or a parent page. This means that it is the main page. However, you can create another page under the main page, which is referred to as the child page. So why would you need to have child pages? Sometimes when developing a website, we might get to a situation where we have too many pages.
This can bring in a lot of confusion especially in identifying categories that such pages go under. For example, you might have an About Us page, Our Team page and Our Values page among others. The Team and Values pages can be created as child pages under the About Us page, which would make things easier for organizing your website content and keep it clean. In this tutorial, we are going to learn how to create a child page. Before creating the child page, we will create a parent page.
Creating the Parent Page
To create a parent page, we are going to follow these steps;
- The first step is to log in to the admin dashboard. While there, point at the Pages menu option on the left hand side on the screen then select Add New. You can also click on Pages which will take you to a page will all the pages already created and select the Add New button at the top of the screen.
- You will be taken to another page where you can enter the title and content for the new page. I am going to call this page “I am a Parent Page” and enter some dummy text as content.
- While still creating this page, you can modify its permalink structure. By default, WordPress will create a permalink from the name of the page. In my case, it has created this i-am-a-parent-page as the permalink as shown below.
- I am going to edit my permalink to i-am-a-new-parent-page and then click on the OK button next to it to save my changes, as shown below;
- After doing that, click on the publish button on the left hand side of the screen on the publish panel.
We have now successfully created a page. If you visit the pages section, you will realize that we have this page among the list of pages that you already have created for your website. This page is a parent page by default.
Let us view this page to see how to permalink appears on the browser. To do that;
- On the admin dashboard, click on the Pages menu option to open a list of all pages created.
- Point at the page we have just created to get a popup menu and select the View option.
- You can also view the page by clicking at the View Page link that appears at the top of the screen after clicking on the publish button.
- This directs you to the page on the same tab. Here, you can see that the URL structure picks from the permalink we added when creating the page.
We are now going to create a child page to go under this page.
Creating a Child Page
To create a child page, we are going to follow the same procedure as we did creating the parent page, but along the way, we will set a parent page for this page, hence making it a child page. Here are the steps to follow;
- While on the admin dashboard, point at the Pages menu option and select the Add New option just like we did above.
- Again, you will be taken to the page editor screen where you can create a title for the page as well as add content to the page. I am going to call this page “I am a Child Page” and add some dummy text as content. You can edit the permalink as we did with the parent page as well if you want to change it.
- After doing that, since we are creating this as a child page to the page we created earlier, we are going to navigate to the right hand side of the screen where we have the Page Attributes panel. Here, we are going to select the page we created in the first step above as the parent page from the dropdown menu as shown below.
- Click on the Publish button on the left hand side of the screen under the publish panel.
We have now successfully created a child page. If you visit the child page on a browser, you will notice that the URL is the default permalink created by WordPress when we were creating this page, with the parent page URL as well, as shown below;
Now, we are going to visit the pages screen and see how these pages are linked. You will find that the linking between the parent and the child page is very clear, with the child pages listed just below the parent page with an hyphen before them to indicate that they are child pages. This makes things quite easy for a website that has many pages. To check this, we are going to;
- From the admin’s dashboard, click on the Pages option on the left hand side menu.
- This will take you to a page where you can see a list of all the pages you have created.
Notice that the child page is listed just below the parent page with a “-” sign before it. This sign will be seen before all child pages, and the child pages will be listed below their parent page.
It is a good idea to keep your website organized such that if you were to hand it over to someone else to help with development, they would not have to spend a lot more time learning the organization of your pages. One way to do that is to add child pages under the appropriate pages.