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

WordPress Trac wp-trac at lists.automattic.com
Wed Jul 27 03:57:25 UTC 2011


#18265: Use load_template in template-loader.php
-------------------------+-----------------------------
 Reporter:  elyobo       |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Template     |    Version:
 Severity:  normal       |   Keywords:  has-patch
-------------------------+-----------------------------
 There may be a good reason for this I'm unaware of, but the template
 loader (wp-includes/template-loader.php) does not use the appropriate
 sounding load_template() function.

 The only differences are

  * A potentially smaller number of globals included, as load_templates()
 globalises a smaller list.
  * Query vars are extracted automatically.

 In my plugin, I'm trying to make things easier for our theme folks by
 populating the appropriate data automatically.  This is possible through
 the load_template() function because I can push data into
 $wp_query->query_vars and it will be extract()ed into local variables that
 are available in the template.

 This is *not* possible in things like single-page.php, because template-
 loader.php just includes the template file it finds instead of
 load_template()ing it.

 I have attached the one line patch to change this.  If the reduced number
 of globals would be a problem, it is also easy to include an
 "extract($GLOBALS);" in load_template() as well.

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


More information about the wp-trac mailing list