Show custom field of a subpage on a page
-
Hi all,
Using a snippet of code I found on this forum, I was able to create a list of subpages on a page. It shows the titles of these subpages as a <h3> and displays a link to the subpage.
However, I would like the value of the custom “description” field displayed as well, but I can’t seem to echo the contents of this field.
This is the code I use:
<?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="service"> <h3><?php echo $page->post_title ?></h3> <p><?php get_post_custom_values($description, $page->ID); ?></p> <p><strong>+</strong> <a href="<?php echo get_page_link($page->ID) ?>">details van deze dienst</a></p> </div> <?php } ?>
What is wrong with this? Why won’t the description field show up?
Thanks in advance for any help.
Stef
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Show custom field of a subpage on a page’ is closed to new replies.