You have to change child_of
to post_parent
and also add post_type => 'page'
:
WordPress codex Wp_query Post & Page Parameters
<?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="https://wordpress.stackexchange.com/questions/60292/<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h1>
<p><?php the_advanced_excerpt(); ?></p>
</div>
<?php endwhile; ?>
<?php endif; wp_reset_postdata(); ?>
Related Posts:
- List the 5 most recent child pages
- Set order of returned items in the WP_Query() class/function
- Pagination of a WP_Query Loop in a child-page page template
- Need wp_query to return all children and grandchildren
- How to get all child pages in their parent page?
- Search pages that are a child of the current page
- Get Child Page IDs by Parent ID
- Exclude parent with child pages from WP_Query
- How to Create a Random List of Child Pages
- complex get_posts() query to select child pages
- How to Display Shortcode in the correct location, currently displaying before content after Page Title?
- WP_Query returns different results from get_posts() [closed]
- When listing child pages run out of memory
- wp-query, pull children of parent page
- Get list of all Grandchild Pages
- Show child by slug, while knowing parent ID
- Paginate nested query of child posts
- WP_Query doesn’t return some child pages even though the database shows them
- Get a page ancestor from a most viewed list
- Get Child Custom Post Content on Single.php?
- How to get child pages and add unique class only to active page?
- WP_Query + random
- Function in array as arguments for WP_Query
- Is there a way to extend WP_query so Custom Post Types can have properties?
- How to Compare Two Meta Fields
- What kind of object type is WP_Query?
- $wp_query initiation?
- All-in-One Event Calendar: Custom Query – Getting each event Instance [closed]
- Show two random posts from custom post type
- Duplicate Queries
- Counting number of posts with Category B in Category A
- pagination doesn’t show up for custom post type
- How to modify query so it grabs only 90 posts in total?
- Get only 1 Most Recently Modified Child Post from Parent
- Placing a div or img in between a post array using WP Query [closed]
- How to query ‘posts_per_page’ to display a different blog posts index template?
- Trying to check and see if a post has a featured image outside of the main loop
- Pagination doesn’t work in custom page template [duplicate]
- wp_query a single custom post type?
- Using pre_get_posts on a specific core/query block
- Efficient way to update multiple post meta
- Does meta_query need numeric values to be cast to integers?
- How to use Meta Value Compare in WP_Query For Max and Min numbers
- WordPress documentation – WP_Query arguments
- Using apply_filters(‘the_content’, $custom_query->post_content) alters output
- WP_Query Date Query After Minus Hour AND minus minutes
- Shortcode to show thumbnail and link for 3 random posts
- wp query template tags not working
- Get number of authors
- How to display upcoming events by dat with Modern Events Calendar Lite
- Wp_query Add specific pending posts
- How to Filter Posts by Custom Fields?
- How can I display a custom field from all posts and order them individually from their parent post
- pagination with ‘no_found_rows’ => true,
- How to get all product attributes for filters in WooCommerce?
- Fetch Record based on meta key dates
- Query posts from category A, and from either category B or C
- meta_query not working as expected
- wp_query with parameters
- Query posts with “non set” meta value
- Add filter post_where and passing post_type argument
- WP_Query infinite Loop
- Ordering a mysql style datetime stamp with meta_query
- Advanced WP Query and/or
- 2 wordpress loops showing 1 post from same post type – how to avoid showing the same post?
- WP Query – order posts by meta field first and then order the rest
- Reusing content from front page on sub page
- Wildcard search in WP Query
- Especific order by Custom Field Values in WP_Query
- Create a notification for post field
- date_query is showing duplicate results
- How to query posts for custom post type with featured image for first 2 post?
- Why is get_the_excerpt returning full content
- How to avoid filling up an array each time I run a WP_query?
- Randomly pick one testimonial post
- Date not appearing in custom query
- Custom post type – filter content by custom meta box content
- Trying to output content from page, works locally but not online
- Admin: Custom Query Returning Permissions Error
- Combine relationship posts with existing wp_query
- Slick slider for post doesn’t display anything
- What is the equivalent WP_Query of a SQL Query?
- Count post meta entries
- use mysql variable in a $wpdb->query to reindex a column?
- wp_insert_post with ACF Fields and WP Meta Query returns no rows until update
- Query WP Posts, then list the taxonomies from those posts
- Query post with content only
- Search with WP_Query, but ignore href URLs in anchor tags?
- Displaying Pages in Nav Sub-Menu with Specific Taxonomy Terms?
- Is meta_key used for ordering, filtering, or both?
- compare for multiple meta values for same key in wp_query
- Taxonomy Terms That Don’t Exist Display Results
- Why is my query not giving results?
- Add pagination to table generated by wp_query
- Adding a Theme Customizer Control for Posts_Per_Page
- using next-page and previous page inside a wp_query
- Custom query from all posts & all child page from one parent page?
- wp_query conditionally get posts
- restrict posts per page
- the_excerpt() not working in custom archive