Loading…

How can you display a list of child pages in WordPress?

We can use simplay WP_Query() with post_parent and post_type, then we can get all child pages of that particular parent page.

Example

                                        

$my_query = new WP_Query(array(
    'order' => 'ASC',
    'orderby' => 'menu_order',
    'post_parent' => 13,
    'post_type' => 'page',
));
if($my_query->have_posts())
{
    while($my_query->have_posts())
       {
          // display your required things
       }
}

 

Suggest An Answer

No suggestions avaliable!

Latest post from WordPress Interview Questions

Ask Question