I’m trying to show a list of sibling pages that excludes the current sibling page and includes a few of the ACF fields associated with each sibling page.
The following is what I am using on the parent page to show all the child pages.
<!-- PROJECT TILE -->
<?php $this_page_id=$wp_query->post->ID; ?>
<?php query_posts(array('showposts' => 20, 'post_parent' => $this_page_id, 'post_type' => 'page')); while (have_posts()) { the_post(); ?>
<div class="col-xs-12 col-sm-6 x-tile">
<a href="<?php echo get_permalink(); ?>" class="tile-link">
<div class="x-tile-image"><img src="<?php the_field('grid_thumbnail'); ?>" class="x-the-tile" /><h2><?php the_title(); ?></h2><img src="<?php the_field('grid_thumbnail_hover'); ?>" class="x-the-tile-hover" /></div>
</a>
</div>
<?php } ?>
<!-- /PROJECT TILE -->
To be clear, I have a Parent Page ‘Project Type A’, with child pages ‘Project 1’, ‘Project 2’, ‘Project 3’. When I am on page 1, at the bottom of the page I want to display fields from 2 & 3.
I’ve tried changing the post_parent args to reference the proper starting point but this has failed. Admittedly I’m a php hack. Any help would be appreciated.
Hi @cober
Thanks for reaching out to us.
You may consider using the post_not_in option in your query as follows .
'post__not_in' => array($post->ID)
Hope this helps.