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.

Was This Tutorial Helpful?

Free

$0

Access only to all free tutorials per month.



Monthly

$75

Access to 10 premium tutorials per month.


Tutorial Request


Includes code guarantee and coding support.

Yearly

$500

Access to 15 premium tutorials per month.


Monthly Tutorial Request


Includes code guarantee and priority coding support.