There is no specifica template for child pages, but you can do this pretty easily with the get_template_part() function.
First create a file called “content-child.php”.
Second create a file called “content.php”.
Next, inside of page.php, place this:
if( $post->post_parent !== 0 ) {
get_template_part('content', 'child');
} else {
get_template_part('content');
}
Anything that you want displayed on a child page will be placed inside of content-child.php. Anything you want displayed on non-child pages will be placed in content.php.
Related Posts:
- A check for if is parent page, if has children, if has grandchildren
- Custom page template for multiple pages
- WordPress Page doesn’t load the template selected
- WordPress custom pages in a folder
- WP Template Hierarchy – Need help choosing the correct templates
- Custom templates not showing up in template dropdown
- Check if is on child-page of a particular page
- Can I have two child pages of different parents with the same name?
- Create a “Dummy” parent page for a hierarchy in page listing?
- Allow only new sub-pages to be created
- Set page template automatically based on parent
- Get Permalink for the top level parent of child pages
- Some pages are missing from the Parent Page select in the Editor
- How to display code if it is not certain pages?
- How do I set and list page_template with wpcli?
- How do I modify this page template to show subpage excerpts (not post excerpts)?
- Limit number of pages that use a specific template?
- How to display list of child pages of parent page in wordpress?
- Dynamically Load Styles and Scripts from Theme Functions.php
- Only allow new subpages to be created
- Different “Text Widgets” in Sidebar on Many Different Pages?
- Can’t change parent page
- How do I create multiple page while active a theme
- How to dynamically save a selected option from page “Templates” selectbox?
- Show child pages when on a child page
- select a private page as parent for another private page
- How to add meta boxes to Pages
- Custom page template not working
- WordPress pages with hierarchy
- Dynamically change page that loads
- How do I pass data from page content to the underlying PHP template
- remove/hide pages from users backend
- Removing the TinyMCE editor for a given page template
- List child pages by slug not ID?
- Determine page content based on page parent
- Displaying page content in category archive (archive.php)
- How to hide all child pages with post_query?
- Missing ‘Page Attributes’ in page edit
- get_pages() & “child_of”
- Combining ‘depth’ with ‘include’ in wp_list_pages()
- Could be a namespace conflict (?) with login form and register form on the same page
- Organizing Your Pages
- My custom template page not loading content inside it?
- Can a user find a child page?
- Get parent of current page
- Redirect page to default subpage
- How to edit a HTML list in WordPress?
- How to list a page tree?
- JQuery Plugins in WordPress
- Remove comment section from new page
- WordPress theme: Add page content to the bottom of the Contact form
- Dynamic href link to Contact Page
- Create page template with some static contents
- Avoid pages losing template association on site re-deploy
- How do I edit text displayed on my browser tab?
- How to create different template designs for different pages in WordPress [closed]
- Different css file not working for the page template I created
- Keep page hierarchy in wp_list_pages, even if on a child or grandchild
- Page templates in subdirectories and auto generator
- Use page template for custom $_GET content
- Using index.php as page template
- Listing all child-pages of a parent-page on the parent-page and each child-page?
- Custom folder for wordpress page templates
- How to control display of page lists on sidebar that doesn’t have childrens
- anchor tag in header not working on other pages except the home page
- Authors posts on a author created page
- Check if page has subpages
- Static Website No Titles But Still Nav
- custom page templating in WordPress
- Suggestions: Customizable header image and style colors that are different for each page
- Search anything from a Child and Sub-Pages of their Parent page
- My pages are using my Index.php and not my page.php
- Create page template
- Return true if parent page id matches
- WordPress blog posts template bug [closed]
- Adding styles/scripts to specific page
- How to detect if some page template has been selected
- WordPress form submit to custom page template does not work
- Using external DB within wordpress
- What’s the best way to manage sections on a page?
- Display grandchild page content on parent page
- How do you assign custom template for Posts page (under Front page displays setting)
- 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?
- Content template when adding a new page
- custom page or standalone page?
- Avada Theme – Display results from a specific category [closed]
- How to display time when page is created and edited
- Firing page_publish where page is child page
- How to finish this loop?
- Specify parent page template
- Custom Filter using meta_value in wordpress admin list not working
- displaying child pages in columns when on a parent page
- Woocommerce – Making product pages child of shop
- Create a new page for each form selection
- link a custom page into menu
- Load new Posts on Scroll on Page
- exclude page element from specific pages