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

Sponsors

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=' );
}

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS

You may like following Articles!

One thought on “How to List the child pages by post slug OR post ID

  1. This is a good tip particularly to those fresh to the blogosphere.
    Brief but very precise info… Appreciate your sharing this
    one. A must read post!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>