Last active
December 16, 2015 05:58
-
-
Save tinotriste/5387872 to your computer and use it in GitHub Desktop.
Wordpress: Display subpages of a page with their custom meta
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
<?php | |
$args = array( 'orderby' => 'menu_order', // Allows users to set order of subpages | |
'order' => 'ASC', | |
'post_parent' => $post->ID, | |
'post_type' => 'page', | |
'post_status' => 'publish' | |
); $postslist = get_posts($args); | |
?> | |
<?php foreach ($postslist as $post) : setup_postdata($post); ?> | |
<!-- Enter code to display for each subpage here. For example, list items | |
containing featured thumbnails, page titles and permalinks to the pages. | |
EXAMPLE BELOW: --> | |
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"> <?php if ( has_post_thumbnail() ) { the_post_thumbnail(); }; ?> </a> | |
<?php the_excerpt(); ?> | |
<?php endforeach; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment