Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //display list of subpages with featured images as thumb
- //get the list of child pages
- $mypages = get_pages( array( 'child_of' => $post->ID, 'sort_column' => 'post_date', 'sort_order' => 'desc' ) );
- //if the page has no children, get the parent's children
- if ( !$mypages)
- $mypages = get_pages( array( 'child_of' => wp_get_post_parent_id( $post_ID ), 'sort_column' => 'post_date', 'sort_order' => 'desc' ) );
- foreach( $mypages as $page ) {
- if ( $page->ID != $post->ID){ //don't display the member's thumbnail if it's the member's page
- $content = $page->post_content;
- if ( ! $content ) // Check for empty page
- continue;
- $content = apply_filters( 'the_content', $content ); ?>
- <div class="home_post_box team">
- <a href="<?php echo get_page_link( $page->ID ); ?>"><?php echo get_the_post_thumbnail( $page->ID, 'medium' ); ?></a>
- <h4><a href="<?php echo get_page_link( $page->ID ); ?>">
- <?php echo $page->post_title; ?></a></h4>
- </div>
- <?php
- } //end if
- } //end foreach
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement