[wp-trac] [WordPress Trac] #21676: Pass a variable to get_template_part()

WordPress Trac noreply at wordpress.org
Thu May 29 21:22:37 UTC 2014


#21676: Pass a variable to get_template_part()
-----------------------------+-------------------------
 Reporter:  sc0ttkclark      |       Owner:
     Type:  enhancement      |      Status:  closed
 Priority:  normal           |   Milestone:
Component:  Template         |     Version:  3.4.1
 Severity:  normal           |  Resolution:  maybelater
 Keywords:  has-patch close  |     Focuses:
-----------------------------+-------------------------

Comment (by bigdawggi):

 Is it time to re-examine this?  I definitely prefer the approach of
 passing `$data` or `$args` as an associative array into
 `get_template_part()`; but whether it's `get_template_part()` or another
 similar function, I strongly recommend this be implemented with core.

 I agree with Nacin's point about the data being extractable -- not
 `$args['data']` from [ticket:21676#comment:10 Comment 10] :

 > $_data should always be an array and should be extracted. It should be
 for passing variables, not arbitrary data.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/21676#comment:48>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list