How to display image on parent from chil
-
Hey folks,
wondering if you could help me out, Im new to the wp templates,I want the parent category page to display the picture from a childs page,
I created a custom value called image on the childs page and have been using the following 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 ); ?> <h2 class="subpagetitle"> <a href="<?php echo get_permalink($pageChild->ID); ?>" rel="bookmark" title="<?php echo $pageChild->post_title; ?>"> <img style="float:left;margin: 0 10px 10px 0;border:1px solid #000;height:90px" src="<?php $child_pages = get_post_custom_values("Image"); echo $values[0]; ?>" alt="thumbnail" height="90" /> <?php echo $pageChild->post_title; ?></a></h2> <?php the_excerpt();?> <?php endforeach; endif; ?>
If I create a custom value in the parent page called Image and give it a picture it displays that image but not the childs value,
Can you help?
Thanks in advance
- The topic ‘How to display image on parent from chil’ is closed to new replies.