Display Child Pages

Today I came across the need to display the children of a specific page on that specific page on their WordPress site. Originally, I was going to create a custom post type for these children, but I because there would only be two children, I felt that creating a custom post type would be a bit of an overkill. Furthermore, the client for which I was building the site would likely be a bit confused as to why these children pages had a separate area when they really weren’t that different from a standard page. Therefore, I felt it would be best to simply display the child pages for this particular parent page.

Provided you have the ID of the post for which you’d like to display the children, this is fairly easy to accomplish. Below is the formula I used (just placed in page.php):

<?php if(is_page(8)) { ?>
     <?php $pages = get_pages(array('child_of' => 8, 'sort_colum' => 'menu_order', 'sort_order' => 'DESC'));
     foreach((array)$pages as $page) {
          $id = $page->ID;
          $image = get_the_post_thumbnail($id, 'full');
          $link = get_post_permalink($id);
          $title = $page->post_title;
          $content = $page->post_excerpt;

          <div class="attorney">
               <div class="image">
                    <?php echo $image;?>
               <div class="info">
     <?php }