[wp-trac] [WordPress Trac] #41558: create a (reusable) wp_default_admin_scripts

WordPress Trac noreply at wordpress.org
Mon Aug 7 01:26:33 UTC 2017


#41558: create a (reusable) wp_default_admin_scripts
-------------------------+---------------------------------
 Reporter:  drzraf       |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Themes       |     Version:  2.6
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:  ui, administration
-------------------------+---------------------------------

Comment (by drzraf):

 1) to my knownledge {{{$script->add()}}} just make scripts available
 without actually enqueing them
 2) for {{{ wp_enqueue_script() }}} to work, scripts would have to be
 registered. They are not.
 3) I do enqueue selectively. This is what I enqueue to get a roughly
 working dashboard-style page avaiable to the frontend (it's
 {{{acf_form()}}} based):

 {{{
   foreach( [ 'thickbox',
              'media-views',
              'imgareaselect',
              'colors',
              'ie',
              'utils',
              'svg-painter',
              'acf-global',
              'wp-auth-check',
              'acf-input',
              'acf-pro-input',
              'select2',
              'acf-datepicker',
              'acf-timepicker',
              'buttons',
              'wp-color-picker' ] as $s) {
     wp_enqueue_style($s);
   }

 }}}

 But still, I *had* to copy the 210 LoC of {{{wp_default_admin_scripts}}}
 in a custom {{{wp_enqueue_scripts}}} hook in order to get these styles
 actually added.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41558#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list