Suppose I have inserted 3 featured image on my child pages(lets say, featured image 1, featured image 2, featured image 3). Now on my parent page, I need to query all of its child page with specific featured image. Lets say the query must get the featured image 2 only. Heres my code so far.
<?php $pages = get_pages(array('child_of' => $post->ID, 'sort_column' => 'post_date')); ?>
<div id="child-list">
<?php foreach ($pages as $page): ?>
<div>
<a href="<?php echo get_page_link( $page->ID ); ?>"><?php echo $page->post_title; ?><br>
<?php kd_mfi_the_featured_image('featured-image-2', 'page');
echo get_post_meta($page->ID, 'featured-image-2', true); ?>
</a>
</div>
<?php endforeach; ?>
It seems I'm having problem on
kd_mfi_the_featured_image('featured-image-2', 'page'); echo get_post_meta($page->ID, 'featured-image-2', true);
but it works when I am previewing the child page, I could see the image 'featured-image-2' just changing $page-ID to get_the_ID(). Hope someone could give me an advice how to accomplish it.