• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2785

Original Genesis & WooCommerce Tutorials & 6000+ Guaranteed Code

Snippets

  • Try Premium
  • Log in

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.

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags