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 “Blog” template hierarchy
- get_template_parts() usage
- Get_Template_Part and Template files in TwentyTwentyFour Block Editor
- Officially, what is typename for?
- Argument list for class template is missing
- What does “missing template argument” mean?
- What does “missing template argument” mean?
- Difference of keywords ‘typename’ and ‘class’ in templates?
- Can you recommend a .net template engine?
- Flask raises TemplateNotFound error even though template file exists
- How to use Class
in Java? - “Implicit instantiation of undefined template” when forward declaring template class
- “used without template parameters”
- C++ template constructor
- error C2106: ‘=’ : left operand must be l-value
- c++ –
- use of class template requires template argument list
- ‘if’ statement in jinja2 template
- C++ Templates – LinkedList
- C++ template – error: expected initializer before ‘<' token
- template argument deduction/substitution failed, when using std::function and std::bind
- WooCommerce action hooks and overriding templates
- Class template inheritance C++
- got “cannot appear in a constant-expression” when using template
- In C++ what does template<> mean?
- non-member function cannot have cv-qualifier
- How can I add reflection to a C++ application?