[wp-trac] [WordPress Trac] #21676: Pass a variable to get_template_part()
WordPress Trac
noreply at wordpress.org
Tue Feb 19 19:21:45 UTC 2013
#21676: Pass a variable to get_template_part()
-----------------------------+------------------------------
Reporter: sc0ttkclark | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Template | Version: 3.4.1
Severity: normal | Resolution:
Keywords: has-patch close |
-----------------------------+------------------------------
Changes (by sc0ttkclark):
* cc: lol@… (added)
Comment:
The idea behind this patch was to give get_template_part the ability to
work more like a normal include/require works, passing variables from the
current scope (or whatever is wanted) directly to the new scope of
load_template()
Using globals and doing the custom code for each template was something I
explicitly set out not to have to do for every single template. There's
just no other cleaner way that I can see to bring variables in scope
(without making them globals) with the template being included.
Passing $args to get_template_part also opens things up to further patches
that could also enhance how it works and functions.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/21676#comment:25>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list