Template To List Sub/Child Pages Of a Parent Page & Exclude Grand Children In Genesis

Using the following arguments with wp_list_pages, we can display a list of all child pages of 1 parent page.

We can also exclude all grandchildren so only one level of child pages is returned.

‘child_of’ : Display only the sub-pages of a single page by ID. .
‘depth’ : Number of levels in the hierarchy of pages to include in the generated list. Accepts -1 (any depth), 0 (all pages), 1 (top-level pages only), and n (pages to the given n depth).

Here’s the code you can use in a template. In this case its wrapped in a Genesis hook however you can use it in any theme simply by removing the hook and adding the code to a page template or template tag.

You can add the code to a file in your child themes root directory and select the template from the Page Attributes drop down menu named Templates.

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.