Support » Fixing WordPress » Echo child pages of parent page in respective template

  • Hi,

    So I have a page called meet the team, and then child pages with each staff member.

    I can echo the child pages within the homepage fine.

    Each child page has it’s own template, I want to echo each respective template within the loop.

       $pages = get_pages('child_of=29&sort_column=menu_order&sort_order=asc');
       $i = 0;
       foreach($pages as $page) {?>
          Each template for child page goes here
    <?php $i++; } ?>

    Example of child page template

    <?php /*Template Name: Team Long Photo Bottom*/ ?>
    <article class="longTop">
        <div class="photo">
            <?php echo get_the_post_thumbnail($page->ID, ''); ?>
        <div class="text">
            <h2 class="name"><?php the_title();?></h2>
            <div class="title"><?php echo get_post_meta($post->ID, 'title', true); ?></div>
            <p class="content"><?php the_content(); ?></p>
  • The topic ‘Echo child pages of parent page in respective template’ is closed to new replies.