Last active
February 2, 2018 03:48
-
-
Save jbd91/384c192e2c6ccd9273aa904b21983226 to your computer and use it in GitHub Desktop.
WP Query - Children of Parent Page
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 = [ | |
| '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(); ?> | |
| <?php endwhile; ?> | |
| <?php wp_reset_postdata(); ?> | |
| <?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment