Advertisement
alchymyth

page siblings

Mar 12th, 2012
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.47 KB | None | 0 0
  1. <?php global $post; //not neccessary if used in the loop
  2. $parent = $post->post_parent;
  3. if( $parent ) :
  4.     $siblings = get_pages( 'child_of=' . $parent . '&parent=' . $parent . '&exclude=' . $post->ID);
  5.     if( $siblings ) foreach( $siblings as $sibling ) :
  6.         //start of whatever you need to output//
  7.         echo $sibling->post_title;
  8.         echo get_the_post_thumbnail($sibling->ID,'medium');
  9.         //end of whatever you need to output//
  10.     endforeach;
  11. endif; //ends if( $parent ) //
  12. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement