[wp-trac] [WordPress Trac] #23180: Introduce get_plugin_part
WordPress Trac
noreply at wordpress.org
Fri Jan 11 17:24:32 UTC 2013
#23180: Introduce get_plugin_part
-----------------------------+--------------------------
Reporter: wonderboymusic | Type: defect (bug)
Status: new | Priority: normal
Milestone: Awaiting Review | Component: Plugins
Version: | Severity: normal
Keywords: dev-feedback |
-----------------------------+--------------------------
To anyone who uses "plugins" to package components that contain UI
elements, this might be a no-brainer. Themes have a dead simple way of
loading template parts from anywhere without having to resolve paths:
`get_template_part()`. Because the arguments passed are arbitrary strings,
it's easy to reference templates in deep directories by doing
`get_template_part( 'artist/reviews', 'main' )` and the like.
This is all well and good, but it would awesome to be able to grab
"template parts" from plugins as well, from anywhere, without having to
resolve path dependencies on your own.
I attempt to solve this with `get_plugin_part()`
Example for a plugin called JJJ, which has a template called `cat-
meow.php` in a folder called `views`:
`get_plugin_part( 'jjj', 'views/cat', 'meow' );`
--
Ticket URL: <http://core.trac.wordpress.org/ticket/23180>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list