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

WordPress Trac noreply at wordpress.org
Wed Jul 1 23:15:51 UTC 2020


#21676: Pass a variable to get_template_part()
-------------------------------------+------------------------------
 Reporter:  sc0ttkclark              |       Owner:  SergeyBiryukov
     Type:  enhancement              |      Status:  reviewing
 Priority:  normal                   |   Milestone:  Awaiting Review
Component:  Template                 |     Version:  3.4.1
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:
-------------------------------------+------------------------------

Comment (by apedog):

 Backward compatibility in this case is the ability to use query_vars
 directly within the templates. It is an established way to access
 variables within the template parts.

 It's my opinion that it would be beneficial (and less confusing) if this
 pattern of accessing variables directly within the templates is kept
 consistent with how query_vars are accesses within the templates.

 If the issue is using {{{extract()}}}, per se, then surely code can be
 written to achieve the same effect with a {{{foreach}}} loop, no?

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


More information about the wp-trac mailing list