Move scripts to wp_footer();
-
Hello,
Thanks for building this plugin. It works really well!
I’m trying to get all renderblocking scripts out of the <head> per Google PageSpeed Insights. Is there a chance we could set the $in_footer param to true on the script enqueues? I just added true to the 6 enqueue functions in class-daves-wordpress-live-search.php:
if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { wp_enqueue_script( 'daves-wordpress-live-search', plugin_dir_url( __FILE__ ) . 'js/daves-wordpress-live-search.js', array( 'jquery' ), null, true ); wp_enqueue_script( 'excanvas', plugin_dir_url( __FILE__ ) . 'js/excanvas.js', 'jquery', null, true ); wp_enqueue_script( 'spinners', plugin_dir_url( __FILE__ ) . 'js/spinners.js', 'explorercanvas', null, true ); } else { wp_enqueue_script( 'daves-wordpress-live-search', plugin_dir_url( __FILE__ ) . 'js/daves-wordpress-live-search.min.js', array( 'jquery' ), null, true ); wp_enqueue_script( 'excanvas', plugin_dir_url( __FILE__ ) . 'js/excanvas.compiled.js', 'jquery', null, true ); wp_enqueue_script( 'spinners', plugin_dir_url( __FILE__ ) . 'js/spinners.min.js', 'explorercanvas', null, true ); }
I haven’t done extensive testing on this, but let me know if you want me to. You have the dependencies set correctly, so if jquery is set in the header, it should still work correctly.
Thanks!
https://www.ads-software.com/plugins/daves-wordpress-live-search/
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Move scripts to wp_footer();’ is closed to new replies.