Get content of a child page
-
Hi, I trying to show list of child pages inside of parent page. I have this code
<?php $mypages = get_pages( array( 'child_of' => $post->ID,'parent' => $post->ID, 'sort_column' => 'menu_order','sort_order' => 'ASC' ) ); $counter = 1; foreach( $mypages as $page ) { $content = $page->post_content; if($counter % 4 == 0) { echo '<div class="row">'; } ?> <h3><?php echo get_the_title( $page->ID ); ?></h3> <?php echo get_the_content( $page->ID ); ?> <?php if($counter % 4 == 0) { echo '</div>'; } $counter++; } ?>
For some reason I cannot make work to display content of child pages, though title works fine. Any ideas why is that?
Thanks
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Get content of a child page’ is closed to new replies.