[wp-trac] [WordPress Trac] #9346: wp_enqueue_script() doesn't work mid-page for footer scripts

WordPress Trac wp-trac at lists.automattic.com
Wed May 11 07:24:28 UTC 2011


#9346: wp_enqueue_script() doesn't work mid-page for footer scripts
--------------------------+-----------------------------
 Reporter:  Viper007Bond  |       Owner:  azaozz
     Type:  enhancement   |      Status:  reopened
 Priority:  lowest        |   Milestone:  Future Release
Component:  JavaScript    |     Version:  2.8
 Severity:  minor         |  Resolution:
 Keywords:  has-patch     |
--------------------------+-----------------------------

Comment (by philipwalton):

 For what it's worth, I ran into another situation other than shortcodes
 where I needed to make the decision whether or not to enqueue a script
 after the `admin_enqueue_scripts` hook was fired. In this case on the
 admin side.

 I'm using an MVC plugin framework that loads a view file for the settings
 form. In the view file the user of the framework creates a form object,
 e.g:
 {{{
 $form = new MVC_Active_Form;
 $form->ajax_validation = true;
 }}}
 So the framework has no idea whether or not the settings form will require
 ajax validation until after WordPress loads it, which doesn't happen until
 well after the `admin_enqueue_scripts` hook is fired.

 Anyway, I just thought I'd offer another example to support a better
 implementation of `wp_enqueue_script()` in core. In the meantime the
 proposed work-around is doing the trick.

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


More information about the wp-trac mailing list