[wp-trac] [WordPress Trac] #21676: Pass a variable to get_template_part()
WordPress Trac
noreply at wordpress.org
Thu Jul 2 15:05:44 UTC 2020
#21676: Pass a variable to get_template_part()
-------------------------------------+-----------------------------
Reporter: sc0ttkclark | Owner: SergeyBiryukov
Type: enhancement | Status: reviewing
Priority: normal | Milestone: 5.5
Component: Template | Version: 3.4.1
Severity: normal | Resolution:
Keywords: has-patch needs-testing | Focuses:
-------------------------------------+-----------------------------
Changes (by overclokk):
* version: => 3.4.1
Comment:
It is not a good idea to use `extract()` beacuse you may have bad moment
while debugging your code.
Instead of `$args` we could use `$data`.
A while ago a wrote an adapter for `get_template_part()` that pass `$data`
variable to a View object, this is the implementation I made
https://github.com/ItalyStrap/view/blob/master/functions/helpers.php
--
Ticket URL: <https://core.trac.wordpress.org/ticket/21676#comment:105>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list