Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. //display list of subpages with featured images as thumb
  2. //get the list of child pages
  3. $mypages = get_pages( array( 'child_of' => $post->ID, 'sort_column' => 'post_date', 'sort_order' => 'desc' ) );
  4.  
  5. //if the page has no children, get the parent's children
  6. if ( !$mypages)
  7. $mypages = get_pages( array( 'child_of' => wp_get_post_parent_id( $post_ID ), 'sort_column' => 'post_date', 'sort_order' => 'desc' ) );
  8. foreach( $mypages as $page ) {
  9. if ( $page->ID != $post->ID){ //don't display the member's thumbnail if it's the member's page
  10. $content = $page->post_content;
  11. if ( ! $content ) // Check for empty page
  12. continue;
  13. $content = apply_filters( 'the_content', $content ); ?>
  14. <div class="home_post_box team">
  15. <a href="<?php echo get_page_link( $page->ID ); ?>"><?php echo get_the_post_thumbnail( $page->ID, 'medium' ); ?></a>
  16. <h4><a href="<?php echo get_page_link( $page->ID ); ?>">
  17. <?php echo $page->post_title; ?></a></h4>
  18. </div>
  19. <?php
  20. } //end if
  21. } //end foreach
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement