The code used to make this decision by WordPress is get_page_template()
. The pagename version (page-{slug}.php
) is pulled from get_query_var( 'pagename' )
, you can use this in your page.php
template to see what it outputs when visiting the child page.
<?php echo get_query_var( 'pagename' ); ?>
This mostly just means that the parent slug is ignored so /employers/executive-search/
and /executive-search/
and /random/executive-search
will all use the same page template of page-executive-search.php
if available.
Or you can just use the ID
of the page page-NN.php
Related Posts:
- Custom templates not showing up in template dropdown
- Get page id by template
- How to set post slug when using wp_insert_post();?
- Change page template programmatically ?
- 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?
- Limit number of pages that use a specific template?
- Hide page visual editor if template is selected – redux
- 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
- Template for child pages / subpages
- How to dynamically save a selected option from page “Templates” selectbox?
- Include a specific page in your template
- Custom page template not working
- How do I create a separate page for each author?
- Slug is redirecting to 404
- Using page slug in array
- How do I pass data from page content to the underlying PHP template
- 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?
- 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
- Create a page that’s to not be indexed or accessible via slug
- Remove Content edit box from ALL pages (not posts)
- Get the Current Page Slug-Name
- Is it possible to activate page template without manually selecting it in wp-admin?
- Attachment pages stealing page slugs
- Hide page templates without using ‘unset’
- the_content of template page
- 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
- Is it possible to restrict access to specific pages in the admin area based on the page slug?
- Is it possible to change slugs’ default behaviour?
- List child pages within page template
- Using page-something.php as static front page
- 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
- How does wordpress link page templates to individual pages
- Page Slug Won’t Change – Can’t Edit Archive Page With Slug or Reassign Slug
- Create custom page to author.php
- Can’t find the page that is using a slug
- Template field missing in page attributes
- Different template parts when on different pages
- Updating page template pragmatically
- WordPress blog posts template bug [closed]
- Adding styles/scripts to specific page
- WordPress form submit to custom page template does not work
- How do I locate a third party page represented as a slug in my WordPress website?
- Cannot use old slug – it just 301s to site home page
- Display grandchild page content on parent page
- How do you assign custom template for Posts page (under Front page displays setting)
- display different pages content on single page
- How to output different content of page on different places in my template
- Avada Theme – Display results from a specific category [closed]
- Multiple pages to show posts
- How to finish this loop?
- Auto-Create Pages from Template Directory
- Loading custom jQuery and HTML in a WordPress page
- different single.php for different page templates
- how bbPress and buddypress add their own page templates to the page template drop down on the page editing screen
- Using Page/Post Slug In Link / URL
- Naming custom page templates
- How can I use Page editor for two separate templates?
- Display random page
- How to read a page’s “Shortcodes” from the Template File?
- if and else statement not working on the iframe php page
- Custom SINGLE page with custom metaboxes and custom template
- I reached halfway through a WordPress tutorial to find out I began wrong for a new comer to WP
- Custom template is not showing up in templates dropdown list after re-naming it
- May I know where to edit the tax rate?
- Dynamic content in a static page
- Can I set a timer for pages to be published?
- Add a Menu Link (to a WordPress Page) in the Admin Menu/Sidebar
- Admin pages, edit notes of the title of posts and pages
- WordPress pages creation work distribution & then combining – Localhost XAMPP
- How To Render Shortcode In AJAX Response?
- Do I have to widgetize my pages?
- How do I structure my permalinks in WordPress?
- add title to widgets of wordpress
- Custom user tables not working after migration
- How can a .css file be applied to a virtual page?
- Checkboxes to automatically create pages when I activate a theme
- My pages disappeared from the list