‘Function Get Pages” help please :)
-
Gday,
I am attempting to have a parent page display $more content + link to full content of all children pages.
I found the following code (below) from here Codex -Function Reference/get pages but it doesn’t quite do what I’m after.
I need help adjusting the below code to:
- only output $more content of children pages + title + read more link (at the moment it outputs all content of the child pages)
- only output children pages of the “Gallery” page id=88 (for some reason it is including content of another non related page
- output all children pages of the parent, not just 2.
<?php $pages = get_pages('child_of=gallery'.$post->ID.'&sort_column=post_date&sort_order=desc'); $count = 0; $more = 0; foreach($pages as $page) { $content = $page->post_content; if(!$content) continue; if($count >= 2) break; $count++; $content = apply_filters('the_content', $content); ?> <h3><a href="<?php echo get_page_link($page->ID) ?>"><?php echo $page->post_title ?></a></h3> <?php echo $content ?> <?php } ?>
Help would be greatly appreciated.
Cheers
- The topic ‘‘Function Get Pages” help please :)’ is closed to new replies.