Skip to main content
2 of 2
Modified
M1lls
  • 117
  • 3
  • 7

List pages including both parent and child pages

I'm currently listing WordPress pages and child pages on a side widget using the following code.

<ul class="side-links">
  <?php wp_list_pages( array( 

    'title_li' => '' 

   ) );
  ?>
</ul>

This lists all of my WordPress pages, if I add the following code

'child_of' => $id

into the array I get the children on the parent page, If I go to a specific child page the list will not be displayed. I just need the list of child pages to be displayed on all pages including parent and child pages.

If it helps I've placed the following wp_list_pages function on this page in the following theme. https://github.com/holger1411/understrap/blob/master/loop-templates/content-page.php

M1lls
  • 117
  • 3
  • 7