WordPress.org

Ready to get started?Download WordPress

Forums

Page's siblings with thumbs (1 post)

  1. Ant94
    Member
    Posted 1 year ago #

    I make some navigation with thumbnails. I've made already such navigation for parent page, but struggle with getting the thumbs of sibblings while exploring one of children. Idea is that when I explore one of children I get in the navigation all siblings.

    So far I found this:

    <?php
    $children = wp_list_pages('title_li=&child_of='.$post->post_parent.'&echo=0');
    if ($children) {
        echo $children;
    }
    ?>

    For the navigation for parents' page I use this:

    <?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="thumb">
    <div class="thumb_img"><a href="<?php echo  get_permalink($pageChild->ID); ?>" rel="bookmark" title="<?php echo $pageChild->post_title; ?>">
     <?php echo get_the_post_thumbnail($pageChild->ID, 'medium'); ?></a>
    <h2><?php echo $pageChild->post_title; ?></h2>
     </div>
    
    </div>
    <?php endforeach; endif;
    ?>

    How can I modify 'echo $children;' to get the thumbnails of children?

Topic Closed

This topic has been closed to new replies.

About this Topic