Created
July 1, 2017 21:09
-
-
Save ericjames/3f6308272a448d1c260c5cb3a63290d5 to your computer and use it in GitHub Desktop.
Wordpress List Child Pages with Thumbnails
This file contains 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
<?php if (is_page('web-design')) : ?> | |
<?php $i = 0; ?> | |
<div> | |
<ul> | |
<?php | |
$args = array( | |
'post_parent' => $post->ID, | |
'post_type' => 'page', | |
'post_status' => 'publish', | |
'orderby' => 'menu_order', | |
'order' => 'ASC', | |
'numberposts' => -1, | |
); | |
$postslist = get_posts($args); | |
foreach ($postslist as $post) : | |
setup_postdata($post); | |
$i++; | |
?> | |
<li> | |
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3> | |
<div><a href="<?php the_permalink(); ?>"><?php if( has_post_thumbnail() ) the_post_thumbnail('thumbnail'); ?></a></div> | |
<div> | |
<?php the_excerpt(); ?> —<a href="<?php the_permalink(); ?>">Read more</a> | |
</div> | |
</li> | |
<?php endforeach; ?> | |
</ul> | |
</div> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment