[wp-trac] [WordPress Trac] #14853: WP_Scripts::do_item filter

WordPress Trac wp-trac at lists.automattic.com
Thu Jul 28 12:51:43 UTC 2011


#14853: WP_Scripts::do_item filter
-------------------------+-----------------------------
 Reporter:  mattwiebe    |       Owner:  westi
     Type:  enhancement  |      Status:  accepted
 Priority:  normal       |   Milestone:  Future Release
Component:  General      |     Version:  3.1
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |
-------------------------+-----------------------------
Changes (by scribu):

 * keywords:  has-patch 3.2-early => has-patch


Comment:

 A filter on the entire output would certainly allow the most flexibility,
 including the ability to change the attributes of <script> tags.

 Note however that 'wp_print_scripts' is already used as an action.
 'wp_print_script' would be more appropriate.

 Another idea would be to introduce an {{{add_inline_script()}}} function,
 similar to the newly introduced add_inline_style() in [18464]. Example
 usage:

 {{{
 add_inline_script( 'jquery', '!window.jQuery && document.write(\'<script
 src="js/jquery-1.4.2.min.js"></script>\')' );
 }}}

 It could also accept a third parameter, $position, which could be 'before'
 or 'after'.

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


More information about the wp-trac mailing list