Display child's custom fields on parent page
-
Hi all,
I have a page called “training” with 7 child pages. On the training page I display a list of these child pages as some kind of overview. Apart from the title of and link to the children, I would like to display the content of the custom “description” field I’ve created on the child pages.
I use this code:
<?php $mypages = get_pages('child_of='.$post->ID.'&sort_column=post_date&sort_order=asc'); foreach($mypages as $page) { $content = $page->post_content; if(!$content) // Check for empty page continue; $content = apply_filters('the_content', $content); ?> <div class="traject"> <h3><?php echo $page->post_title ?></h3> <p><?php echo get_post_custom_values('description', $page->ID) ?></p> <p><a href="<?php echo get_page_link($page->ID) ?>" class="button"><span>meer info</span></a></p> </div> <?php } ?>
The title and link are displayed, but no custom description field. How can I fix this problem?
Thanks in advance for your help.
Stef
- The topic ‘Display child's custom fields on parent page’ is closed to new replies.