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
- Conditional tag to check if ‘page.php’ is being used?
- Can I have two child pages of different parents with the same name?
- Create a “Dummy” parent page for a hierarchy in page listing?
- WordPress page edit does not save selected template
- Is it possible to manipulate the list of page templates?
- 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?
- Multiple areas of dynamic content in a page
- 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?
- How to inject custom url path for page ?
- Dynamically Load Styles and Scripts from Theme Functions.php
- Only allow new subpages to be created
- Add custom admin menu item for pages using a certain template
- Different “Text Widgets” in Sidebar on Many Different Pages?
- What’s the most minimal way in which a page can be hooked into WP?
- Can’t change parent page
- How do I create multiple page while active a theme
- How to make certain page templates visible to admin only
- 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
- load common thank you template with different content for different pages
- Password Protected Page Title
- remove/hide pages from users backend
- is_home() returns TRUE on page template
- 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”
- Trying to return list of child pages for a template
- Combining ‘depth’ with ‘include’ in wp_list_pages()
- Could be a namespace conflict (?) with login form and register form on the same page
- Removing Parent Page URL While Keeping the Navigation Intact
- Organizing Your Pages
- My custom template page not loading content inside it?
- Can a user find a child page?
- Display child pages in sidebar of parent page in wordpress
- Get parent of current page
- Display child pages in a parent page? [closed]
- Redirect page to default subpage
- How to edit a HTML list in WordPress?
- How to list a page tree?
- Custom page with queries returns 404
- How to capture GET argument on static page
- List all posts with the parent or grandparent of a page with a specified ID
- JQuery Plugins in WordPress
- the_content of template page
- 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
- WordPress 3.2 – removed ability to select a page template in the page attributes when adding a new page?
- Page access only from a specific page in wordpress website
- Use same page-mypage.php template for several pages
- Avoid pages losing template association on site re-deploy
- How do you implement a page template automatically being applied to a page?
- 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
- require_once not working
- Displaying posts on homepage – Template Page
- Page templates in subdirectories and auto generator
- Use page template for custom $_GET content
- Using index.php as page template
- How to bypass 404 for certain pages/posts?
- Outputting content from page
- 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
- Exclude child pages args array
- custom page templating in WordPress
- page template – undefined structure in source code
- 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