[wp-trac] [WordPress Trac] #18265: Use load_template in template-loader.php

WordPress Trac wp-trac at lists.automattic.com
Wed Jul 27 12:09:13 UTC 2011


#18265: Use load_template in template-loader.php
-------------------------+-----------------------
 Reporter:  elyobo       |       Owner:
     Type:  enhancement  |      Status:  reopened
 Priority:  normal       |   Milestone:
Component:  Template     |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |
-------------------------+-----------------------

Comment (by scribu):

 It would have been nice if load_template() was used (so that there
 wouldn't be an inconsistency between templates loaded by plugins vs.
 templates loaded by Core), but as nacin said, we can't do that, due to
 backwards compatibility.

 > I can push data into $wp_query->query_vars and it will be extract()ed
 into local variables that are available in the template.

 That doesn't sound like a very good practice. The way WP handles this is
 by using template tags (i.e. functions) like the_title(). Your plugin
 should define it's own template tags that access globals in the
 background, as necessary.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/18265#comment:8>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list