Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I need help, I have a page that I want to display content from the page children, I get the content but not the custom fields!

I've tried this but it dosnt work, what am I doing wrong?

<?php
$pages = get_pages('child_of='.$post->ID.'&sort_column=post_date&sort_order=desc&parent='.$post->ID);
    foreach($pages as $page) {
?>

<?php echo apply_filters('the_content', $page->post_content); ?>

<?php echo apply_filters('the_content', get_post_meta($page->post_content, 'custom_tagline')); ?>


<?php } ?>

Please HELP!

share|improve this question

1 Answer 1

Change the line

<?php echo apply_filters('the_content', get_post_meta($page->post_content, 'custom_tagline')); ?>

to

<?php echo apply_filters('the_content', get_post_meta($page->ID, 'custom_tagline')); ?>

See http://codex.wordpress.org/Function_Reference/get_post_meta

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.