I see no reason for this to not work technically, only you don’t need those single quotes around variable.
But practically why not just use page-{slug}.php
or other template option from hierarchy?
Related Posts:
- Passing variables through locate_template
- Is there any way to use get_template_part() with folders?
- How to use get_template_part()?
- Is it possible to override the result of get_template_part()?
- Is there a variable for a template parts name?
- How to make get_template_part always check child theme first?
- Check if partial file is called from within header.php or footer.php
- How to add custom content template part for a custom post type on main query using a plugin
- Too many get_template_parts?
- get_template_part() does not work if you call it when you are in a subfolder
- Get the php template file from other theme folder
- Pass a variable to get_template_part
- How can I see what template parts are being called for rendering the viewable page?
- Get template part vs locate template function
- passing argument to get_template_part() or a better way to code
- get_template_part inside get_template_part?
- Getting the chosen template when iterating through pages
- Templates & CSS – Proper Programming Practice?
- Which custom query am I in and how can I access its properties & methods?
- TwentyTen: Overloading template.php files vs. get_template_part
- Accessing $post variable from template part
- Passing variables to template parts
- How to move style from template file to section?
- Why would include(locate_template) work but not get_template_part()?
- How does get_template_part() work inside a loop?
- Is there a tirck in the get_xxxx function in the general_template.php file?
- Problem with using get_template_part() in footer
- how to remove get_template_part from a plugin? [closed]
- Unable to include a template
- get_template_part() based on get_post_type() for a custom post type instead of get_post_format()
- How to get_template_part using AJAX?
- Where is the template for the ‘standard’ format of a post in the theme twentythirteen?
- Valid HTML in Template Part
- Using get_template_part to retrieve a template file based on current post type
- add a hook with get_template_part()
- how could I load a different template part by page
- ä/ü/… are not displayed when including via get_template_part()
- How to show “teaser” posts on blog / archive pages, otherwise full posts
- Change the file path on get_template_part via plugin
- How do I make a variable available inside partials?
- Using same variable names in files added with get_template_part()
- How to limit the number of Related Posts?
- get_template_part – how to find html file which is being render
- Get_Template_Part And Two Global WP_Query On Frontpage
- The use of get_template_part() returns ‘invalid argument’ loading options
- Remove portion of header code from home page only
- Use a separate template for the home page only
- How to create new template page and template-parts in wordpress theme [closed]
- How to use template inside plugin shortcode with variables for big HTML code
- Get template part with CPT and Custom Taxonomy conditionals
- Passing a variable from the archive page to the default template
- Including template pages within another template?
- Organize template parts and page templates in folders in regards of template hierarchy
- On click some element i want to use some template
- How to get all template files used for rendering a single post/page?
- For which reasons can get_template_part’s $args fail to work? (WP 5.8.1 – PHP 7.4.23)
- Load templates, pass arguments, and render output from functions.php
- Can I set a global base path for get_template_part?
- how to use a different template (index.php) in wordpress
- get_template_part for template in subdirectory not working
- What are the benefits of using get_template_part()?
- Display a custom 404 page without a redirect
- How can I show contents of a template part inside of another page?
- Include template file from plugin to theme
- Use another theme template in my theme
- get_template_part doesn’t output all data
- Using require_once for parent-directory not working but is working in sub-directories
- When to use content-pagename.php?
- Is it possible to call a template file inside wysiwyg editor? And how?
- query_post while (have post) get_template_part()?
- Taxonomy template for all taxonomies attached to certain post type
- If I define a variable in header.php, how do I make it available to templates?
- Make a PHP file with a function
- WordPress: save `get_template_part()` to variable
- Opinions and recommendations on the best barebones base theme [closed]
- Page template in two level deep folder
- Creating a wordpress plugin where users can override templates
- Template for child pages / subpages
- How do I update WooCommerce template files in my theme? [closed]
- More than one search results page template
- Create default_content layout template based on post id
- WordPress editable template fields
- Modify a function without editing template
- How do I create a custom archive page depending on the custom taxonomy type?
- How to hook up search results page to a back-end page?
- How to create a post template with two sidebars
- WordPress 3.3.1 single post template
- get_template_directory() returns wrong address on VPS
- How to create a title images for different posts?
- templates with page teasers Or Featured Items
- If Child or Grandchild of Page
- add_rewrite_rule and template redirect not working
- Different header for each category
- More than one search results page template for two searches on site
- Taxonomy template file not working with a taxonomy that contains a slash
- When using shortcode, content stops generating after the_content
- Redirect Every Instance of The Author Template Pages to Custom Author Pages
- Styling own template
- get_template_part() to render single page Theme
- WP Job Manager – Show recent jobs as cards