Skip to main content
Modified
Source Link
M1lls
  • 117
  • 3
  • 7

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, but the parent link will not be displayed and If I go to a specific child page the list will not be displayed. I just need the current parent and it's childrenlist 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

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, but the parent link will not be displayed and If I go to a specific child page the list will not be displayed. I just need the current parent and it's children 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

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

Source Link
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, but the parent link will not be displayed and If I go to a specific child page the list will not be displayed. I just need the current parent and it's children 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