Last active
May 31, 2019 02:10
-
-
Save dospuntocero/d3f38e258ff7565528926245a84ff6e0 to your computer and use it in GitHub Desktop.
show page children wordpress
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 | |
$args = array( | |
'post_type' => 'page', | |
'posts_per_page' => -1, | |
'post_parent' => $post->ID, | |
'order' => 'ASC', | |
'orderby' => 'menu_order' | |
); | |
$parent = new WP_Query( $args ); | |
if ( $parent->have_posts() ) : ?> | |
<?php while ( $parent->have_posts() ) : $parent->the_post(); ?> | |
<div id="parent-<?php the_ID(); ?>" class="parent-page"> | |
<h1><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h1> | |
</div> | |
<?php endwhile; ?> | |
<?php endif; wp_reset_postdata(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment