page parent showing content of page child only and not page grandchild
-
Hello everybody,
I searched all over the WordPress forums and the internet, but I haven’t been able to find any answers regarding only showing content of direct page child without showing content of page grandchildren on a page parent.
I tried the code that is in the wordpress function reference page for get_pages and tweaking it, but I couldn’t get it to do what I wanted.
<?php $pages = get_pages('child_of='.$post->ID.'&sort_column=post_date&sort_order=desc'); $count = 0; foreach($pages as $page) { $content = $page->post_content; if(!$content) continue; if($count >= 2) break; $count++; //$content = apply_filters('the_content', $content); ?> <div class="entry"><a href="<?php echo get_page_link($page->ID) ?>"><h2><?php echo $page->post_title ?></h2></a><?php echo $content ?></div> <?php } ?>
Thanks for the help,
Gabe
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘page parent showing content of page child only and not page grandchild’ is closed to new replies.