To re-use the same template for different kinds of pages you can use the template_include
filter.
Example given from the docs:
add_filter( 'template_include', 'portfolio_page_template', 99 );
function portfolio_page_template( $template ) {
if ( is_page( 'portfolio' ) ) {
$new_template = locate_template( array( 'portfolio-page-template.php' ) );
if ( !empty( $new_template ) ) {
return $new_template;
}
}
return $template;
}
Related Posts:
- Custom templates not showing up in template dropdown
- Limit number of pages that use a specific template?
- How to dynamically save a selected option from page “Templates” selectbox?
- Custom page template not working
- How do I pass data from page content to the underlying PHP template
- the_content of template page
- Avoid pages losing template association on site re-deploy
- WordPress blog posts template bug [closed]
- Adding styles/scripts to specific page
- WordPress form submit to custom page template does not work
- How do you assign custom template for Posts page (under Front page displays setting)
- Avada Theme – Display results from a specific category [closed]
- how bbPress and buddypress add their own page templates to the page template drop down on the page editing screen
- May I know where to edit the tax rate?
- Get page id by template
- Listing pages which uses specific template [duplicate]
- Is there a way to change the default page template selection?
- Hide page visual editor if certain template is selected?
- WordPress page edit does not save selected template
- Set page template automatically based on parent
- Create built-in pages without creating actual pages
- 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)?
- Dynamically Load Styles and Scripts from Theme Functions.php
- 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)?
- Why is custom template not seen as page with is_page()?
- Page with page template not using template in Preview
- How do I create multiple page while active a theme
- Template for child pages / subpages
- Include a specific page in your template
- How to add meta boxes to Pages
- Where can I access my custom page template?
- How do I create a separate page for each author?
- Custom Template 404 for specific custom post type
- Dynamically change page that loads
- How do i change page template in bulk?
- I have index.php and other files, how do I display other pages?
- is_home() returns TRUE on page template
- Determine page content based on page parent
- Displaying page content in category archive (archive.php)
- Missing ‘Page Attributes’ in page edit
- How to make tag post listing page working?
- Custom page template with entirely different design. Is it possible in?
- Page template no longer exists – metaboxes won’t save
- Could be a namespace conflict (?) with login form and register form on the same page
- Custom page template for multiple pages
- My custom template page not loading content inside it?
- Remove Content edit box from ALL pages (not posts)
- Changing permalink name redirects to another template?
- Get parent of current page
- How to edit a HTML list in WordPress?
- Is it possible to activate page template without manually selecting it in wp-admin?
- Remove comment section from new page
- WordPress theme: Add page content to the bottom of the Contact form
- Create page template with some static contents
- pre-existing data, and entities
- Rewrite to load homepage for a different url
- How do you implement a page template automatically being applied to a page?
- Need to create a custom page on a website
- How to create different template designs for different pages in WordPress [closed]
- Different css file not working for the page template I created
- require_once not working
- Custom form not showing in correct place on page
- Displaying posts on homepage – Template Page
- Page templates in subdirectories and auto generator
- Use page template for custom $_GET content
- creating single page with 2 columns while theme is 3 column
- Using index.php as page template
- Outputting content from page
- How does wordpress link page templates to individual pages
- Static Website No Titles But Still Nav
- Template field missing in page attributes
- My pages are using my Index.php and not my page.php
- WordPress custom pages in a folder
- Different template parts when on different pages
- Create page template
- Updating page template pragmatically
- How to detect if some page template has been selected
- Using external DB within wordpress
- What’s the best way to manage sections on a page?
- Display grandchild page content on parent page
- WordPress Page All Content In Template Good Or Bad Convention?
- display different pages content on single page
- Content template when adding a new page
- How to output different content of page on different places in my template
- How to display time when page is created and edited
- Specify parent page template
- WP Template Hierarchy – Need help choosing the correct templates
- Auto-Create Pages from Template Directory
- Custom Filter using meta_value in wordpress admin list not working
- Loading custom jQuery and HTML in a WordPress page
- different single.php for different page templates
- Create a new page for each form selection
- Using custom post types within a section of a template
- link a custom page into menu
- How to read a page’s “Shortcodes” from the Template File?
- exclude page element from specific pages
- Custom SINGLE page with custom metaboxes and custom template