Today I’ll show you how to display a list of child pages for parent page in WordPress. This is an example of a child page on a parent page for a site.
And here is another one. It looks great for organizing pages.
To get this look on your site, first go to create your own pages and under page attribute, parent page, select the parent page that this will be a part of.
If you don’t see this, go to screen options.
And make sure your page attribute is checked.
Once we have all our child pages setup, we can add this code to the functions.php file on our theme.
This code frist checks to see if a page has a parent page or if it is in fact a parent page, then it displays the child pages. If it isn’t associated with a parent or child page, then this code does nothing.
Next this last line of code adds a shortcode so you can easily display the pages.
To get it to display on a page, we just add this shortcode to it.
Here is an example of adding the shortcode and what it looks like.