Advertise on Site! You can Advertise on our site. Find out More

How to List the child pages by post slug OR post ID

1 Flares Twitter 1 Facebook 0 Google+ 0 StumbleUpon 0 LinkedIn 0 Buffer 0 Filament.io 1 Flares ×

First find the page id using page title or page page slug.

For post title use following code:

<?php
$page = get_page_by_title( 'About' );
wp_list_pages( 'exclude=' . $page->ID );
?>

For post slug use following code:

 $page = get_page_by_path( 'your-page-slug'
echo $page->ID;

Now List the child page by post slug

if ( $page = get_page_by_path( 'your-page-slug' ) ){
  wp_list_pages( 'orderby=name&depth=1&order=DESC&show_count=0&child_of=' .$page->ID . '&title_li=' );
}
1 Flares Twitter 1 Facebook 0 Google+ 0 StumbleUpon 0 LinkedIn 0 Buffer 0 Filament.io 1 Flares ×
  • http://craigslistcarslot.com/ Kathaleen

    I’m really impressed with your writing skills and also with the layout on your weblog.

    Is this a paid theme or did you modify it yourself?
    Either way keep up the nice quality writing, it’s rare
    to see a nice blog like this one these days.

    • http://wordpressapi.com/ WPAPI

      this is not paid theme. I developed myself.

  • http://www.wizard.to/ Velma

    It’s in point of fact a great and helpful piece of
    information. I am satisfied that you just shared this useful information
    with us. Please keep us informed like this. Thank you
    for sharing.

1 Flares Twitter 1 Facebook 0 Google+ 0 StumbleUpon 0 LinkedIn 0 Buffer 0 Filament.io 1 Flares ×