Multiple Featured Images w/ Child Pages
-
Hello I am using the Multiple Featured Images Plugin and I am display child pages on a parent page. The child pages have the multiple featured images and I am having trouble displaying the 2nd featured image on the parent page from the child pages. Here is my code.
<?php $child_pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = ".$post->ID." AND post_type = 'page' ORDER BY menu_order", 'OBJECT'); ?> <?php if ( $child_pages ) : foreach ( $child_pages as $pageChild ) : setup_postdata( $pageChild ); ?> <div class="child-thumb"> <?php if( class_exists( 'kdMultipleFeaturedImages' ) ) { kd_mfi_the_featured_image( 'featured-image-2', 'post' ); } ?> <a href="<?php echo get_permalink($pageChild->ID); ?>" rel="bookmark" title="<?php echo $pageChild->post_title; ?>"><?php echo $pageChild->post_title; ?></a> </div> <?php endforeach; endif; ?>
I also had this code which ws display the 2nd featured image but was only display 2nd child page of currently 4 child pages.
<?php $subs = new WP_Query( array( 'post_parent' => $post->ID, 'post_type' => 'page', 'meta_key' => '_thumbnail_id' )); if( $subs->have_posts() ) : while( $subs->have_posts() ) : $subs->the_post(); ?> <div class="game cat"> <h3><?php the_title(); ?></h3> <table> <tr> <td> <? if( class_exists( 'kdMultipleFeaturedImages' ) ) { kd_mfi_the_featured_image( 'featured-image-2', 'page' ); } ?> </td> <td class="text"> <?php the_content(); ?> <?php $link = get_post_meta($post->ID, 'live-link', true); ?> <br /> <div class="live-link"> <a href="<?=$link?>">View Live Site</a> </div> </td> </tr> </table> </div> <? endwhile; else: echo "<center class=\"coming-soon\">Coming Soon!</center>"; endif; wp_reset_postdata(); ?>
- The topic ‘Multiple Featured Images w/ Child Pages’ is closed to new replies.