Skip to main content

Ok I'm trying to display the parent and the child page links with their featured images

I have this code but the problem wis when on a childpage it doesn't show up how can i make it work?

get_results("SELECT * FROM $wpdb->posts WHERE post_parent = ".$post->ID." AND post_type = 'page' ORDER BY menu_order", 'OBJECT'); ?> ID, 'thumbnail'); ?> ID); ?>" rel="bookmark" title="post_title; ?>">post_title; ?>
<?php
$child_pages = $wpdb->get_results("SELECT *    FROM $wpdb->posts WHERE post_parent = ".$post->ID."    AND post_type = 'page' ORDER BY menu_order", 'OBJECT');
if ( $child_pages ) :
    foreach ( $child_pages as $pageChild ) : setup_postdata( $pageChild ); ?>
        <div class="child-thumb">
            <?php echo get_the_post_thumbnail($pageChild->ID, 'thumbnail'); ?>
            <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; ?>

Ok I'm trying to display the parent and the child page links with their featured images

I have this code but the problem wis when on a childpage it doesn't show up how can i make it work?

get_results("SELECT * FROM $wpdb->posts WHERE post_parent = ".$post->ID." AND post_type = 'page' ORDER BY menu_order", 'OBJECT'); ?> ID, 'thumbnail'); ?> ID); ?>" rel="bookmark" title="post_title; ?>">post_title; ?>

Ok I'm trying to display the parent and the child page links with their featured images

I have this code but the problem wis when on a childpage it doesn't show up how can i make it work?

<?php
$child_pages = $wpdb->get_results("SELECT *    FROM $wpdb->posts WHERE post_parent = ".$post->ID."    AND post_type = 'page' ORDER BY menu_order", 'OBJECT');
if ( $child_pages ) :
    foreach ( $child_pages as $pageChild ) : setup_postdata( $pageChild ); ?>
        <div class="child-thumb">
            <?php echo get_the_post_thumbnail($pageChild->ID, 'thumbnail'); ?>
            <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; ?>
Source Link
Wito
  • 1
  • 1

Show parent & child pages with featured image and hide the current page

Ok I'm trying to display the parent and the child page links with their featured images

I have this code but the problem wis when on a childpage it doesn't show up how can i make it work?

get_results("SELECT * FROM $wpdb->posts WHERE post_parent = ".$post->ID." AND post_type = 'page' ORDER BY menu_order", 'OBJECT'); ?> ID, 'thumbnail'); ?> ID); ?>" rel="bookmark" title="post_title; ?>">post_title; ?>