Support

Account

Home Forums Front-end Issues Pulling data from child pages

Helping

Pulling data from child pages

  • Hi
    I am trying to list all child pages of a current page, and then pull in a custom field. My code is the following:

    <?php
    $children = get_pages('child_of='.$post->ID.'&sort_column=post_date&sort_order=desc&parent='.$post->ID);
    $count = 0;
    foreach($children as $child)
    
    {
    	$range_pic = get_field('range_image', $child->ID);
    ?>
    
    <div class="large-4 columns product-list-item">
    	<a href="<?php echo get_page_link($child->ID) ?>" title="<?php echo $child->post_title ?>">
    		<h3><?php echo $child->post_title ?></h3> 
    		<?php echo $range_pic ?>
    	</a>
    </div>
    
    <?php
    }
    ?>
    

    I have tried a couple of variants but am not really getting anywhere.

  • Hi @andrew

    Can you specify which parts of your code are not working? What exactly do you need help with? Have you debugged the code line by line?

    Thanks
    E

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Pulling data from child pages’ is closed to new replies.