Include parent page in list of child pages

I am trying to list pages for a specific ID but want to include the parent page in the list

?php 
    $parent = 83;
    wp_list_pages( array(
        'title_li'    = '',
        'child_of' = $parent,
    ) );    
?

I tried adding 'include' = 83 but then it only listed the parent and not the children.

Topic wp-list-pages pages Wordpress

Category Web


You can get the parent with wp_get_post_parent_id(get_the_ID()), and store it in a new variable and do the same with the children and then just showcase them in any format you want.

<?php
$theParent = wp_get_post_parent_id(get_the_ID());

if ( $theParent->ID == 83 ) { ?>
  <div class="parent"><?PHP echo get_the_title($theParent); ?></div>
  <ul class="children"><?PHP wp_list_pages(array(
            'title_li' => '',
            'child_of' => $theParent ?> </ul>
 <?PHP } ?>

Hopefully, this helps

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.