Created
January 20, 2017 09:57
-
-
Save geeac/71154c2432d91e6a0e6ed134e5864727 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment