From your question I understand that inside the top level page you want to indicate which child page to include. The obvious way to do this is using a shortcode. So in your functions.php
you would have something like this:
add_shortcode( 'insert_child', 'wpse240522_insert_child' );
In the content of your top level page you would have [insert_child 23]
, where 23 is the ID of the child page.
Now you must define the function that evaluates the shortcode, first getting the child page and then looping through all the grandchild pages:
function wpse240522_insert_child ($child_id) {
$child_page = get_post ($child_id);
// do stuff with the child page
$grandchild_pages = new WP_Query (array ('post_parent' => $child_id));
foreach ($grandchild_pages as $grandchild_page) {
// do stuff with grandchild page
}
}
Related Posts:
- How to finish this loop?
- Custom templates not showing up in template dropdown
- Get page id by template
- Check if is on child-page of a particular page
- Change page template programmatically ?
- A check for if is parent page, if has children, if has grandchildren
- Listing pages which uses specific template [duplicate]
- Is there a way to change the default page template selection?
- Can I have two child pages of different parents with the same name?
- Hide page visual editor if certain template is selected?
- Create a “Dummy” parent page for a hierarchy in page listing?
- Allow only new sub-pages to be created
- Creating a template using a specific slug name, for a page with a parent page
- Is there a default template file for child pages / subpages?
- Get Permalink for the top level parent of child pages
- Some pages are missing from the Parent Page select in the Editor
- Limit number of pages that use a specific template?
- How to display list of child pages of parent page in wordpress?
- Hide page visual editor if template is selected – redux
- Only allow new subpages to be created
- WP is not using the select custom template.php that its selected for a page
- Is it possible to set a page template on a dynamic home page (articles list)?
- Page template gives ‘Parse error: syntax error’ when used, but no error found!
- more tag in the $post->content when get_pages were used
- Why is custom template not seen as page with is_page()?
- Page with page template not using template in Preview
- Can’t change parent page
- Template for child pages / subpages
- How to dynamically save a selected option from page “Templates” selectbox?
- Show child pages when on a child page
- Include a specific page in your template
- select a private page as parent for another private page
- Custom page template not working
- How do I create a separate page for each author?
- WordPress pages with hierarchy
- How do I pass data from page content to the underlying PHP template
- load common thank you template with different content for different pages
- remove/hide pages from users backend
- How do i change page template in bulk?
- Load specific page template based on URI
- I have index.php and other files, how do I display other pages?
- is_home() returns TRUE on page template
- List child pages by slug not ID?
- Using Pages to handle calls for custom post types
- How to make tag post listing page working?
- Custom page template with entirely different design. Is it possible in?
- get_pages() & “child_of”
- Combining ‘depth’ with ‘include’ in wp_list_pages()
- How to make my category archive behave like a page
- Page template no longer exists – metaboxes won’t save
- page-name.php doesn’t execute on custom template
- Removing Parent Page URL While Keeping the Navigation Intact
- Organizing Your Pages
- Custom page template for multiple pages
- Remove Content edit box from ALL pages (not posts)
- Can a user find a child page?
- Display child pages in sidebar of parent page in wordpress
- Display child pages in a parent page? [closed]
- Redirect page to default subpage
- How to list a page tree?
- Is it possible to activate page template without manually selecting it in wp-admin?
- Hide page templates without using ‘unset’
- List all posts with the parent or grandparent of a page with a specified ID
- the_content of template page
- Page access only from a specific page in wordpress website
- Use same page-mypage.php template for several pages
- pre-existing data, and entities
- Rewrite to load homepage for a different url
- Avoid pages losing template association on site re-deploy
- Need to create a custom page on a website
- List child pages within page template
- Using page-something.php as static front page
- Keep page hierarchy in wp_list_pages, even if on a child or grandchild
- Best way to organize data in this scenario
- creating single page with 2 columns while theme is 3 column
- Using index.php as page template
- Listing all child-pages of a parent-page on the parent-page and each child-page?
- How to control display of page lists on sidebar that doesn’t have childrens
- How does wordpress link page templates to individual pages
- Check if page has subpages
- Exclude child pages args array
- Search anything from a Child and Sub-Pages of their Parent page
- Create custom page to author.php
- Template field missing in page attributes
- Different template parts when on different pages
- How to get an array of pages ID by some page’s slug and all its children pages in get_posts() function?
- Updating page template pragmatically
- Return true if parent page id matches
- WordPress blog posts template bug [closed]
- If page or sub page not working as expected
- Adding styles/scripts to specific page
- WordPress form submit to custom page template does not work
- How to use wp_dropdown_pages or wp_list_pages to accomplish a menu like this?
- How do you assign custom template for Posts page (under Front page displays setting)
- display different pages content on single page
- Display inner pages like posts.[Like how post excerpt works]
- How to show the view more on my display of pages shortcode
- Childpage title + content on Parent Page
- How to copy specific page content and create child page?
- How to output different content of page on different places in my template