[wp-trac] [WordPress Trac] #16585: Proposed changes to wp enqueueing and shortcode handling

WordPress Trac wp-trac at lists.automattic.com
Thu Feb 17 22:31:27 UTC 2011


#16585: Proposed changes to wp enqueueing and shortcode handling
-------------------------+-------------------------------------------------
 Reporter:  Jester831    |      Owner:  Jester831
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  General      |    Version:  3.1
 Severity:  major        |   Keywords:  dev-feedback needs-patch needs-
                         |  codex
-------------------------+-------------------------------------------------
 Currently, the only way for a programmer to avoid loading their
 scripts/css on every page is to either peek through the_content() for
 their shortcode and enqueue accordingly, or to use their shortcode handler
 to set a boolean for doing a conditional script print after partially
 loading a page. While this is certainly feasible, it's largely unused and
 the majority of plugins overload css and js unnecessarily.

 I propose that instead of operating under the expectation that all
 programmers do this, we instead implement a mechanism to do this solely
 through wp_enqueue_script and wp_enqueue_style.

 This can be achieved by storing a list of used shortcode tags within a
 pages meta, likely while saving a post or page, that can later be used as
 a conditional check with, among others, wp_enqueue_script and
 wp_enqueue_style.

 A new optional parameter would be then added to wp_enqueue_script and
 wp_enqueue_style that would check said meta, or potentially other meta,
 and conditionally load, without the requirement of any further coding.

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


More information about the wp-trac mailing list