[wp-trac] [WordPress Trac] #13239: Filter locate_template template_names variable
WordPress Trac
noreply at wordpress.org
Sat Jul 29 00:42:59 UTC 2017
#13239: Filter locate_template template_names variable
-------------------------+-----------------------------
Reporter: chrisjean | Owner:
Type: enhancement | Status: reopened
Priority: normal | Milestone: Future Release
Component: Themes | Version: 3.0
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
-------------------------+-----------------------------
Comment (by johnrom):
Replying to [comment:117 dnavarrojr]:
> I would think just adding a filter to add my template folder into the
hierarchy would be a simple thing, but apparently not...
This is completely possible using the {{{template_include}}} filter. This
ticket specifically reflects certain template parts not included in that
filter, such as header and footer.
Also, with a plugin you would probably want more control over how your
template is loaded. I'd look into something similar to WooCommerce's
{{{locate_template}}} function as it allows you to pass the exact
variables you need to the template and keep your template clear of
business logic.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/13239#comment:118>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list