WordPress offers a list of bundled resources like jQuery. So you don’t have to load jQuery every time, but you will have to set the dependency of jQuery of the sources you add.
Although the reasons for proper loading seems clear many plugins and themes haven’t enqueued all their code.
Why do developers skip wp_enqueue_script()?
Solutions to use dynamic variables with wp_enqueue_script:
/** set parameters for display **/
$options = array();
$options['color'] = get_option( ‘color’, ‘blue’ );
wp_register_script( ‘color_display’, plugin_dir_url( __FILE__).’display_color.js’, array( ‘jquery’ ), ’20131108′ );
wp_enqueue_script( ‘color_display’ );
Defer loading plugin
Recent i wrote a plugin for Defer loading. This plugin requires scripts are enqueued proper. Testing this i found many issues with different
- Jetpack like and share plugin: http://plugins.trac.wordpress.org/ticket/2032
- BuddyPress: http://buddypress.trac.wordpress.org/ticket/5208 and http://buddypress.trac.wordpress.org/ticket/5209
- BBPress: http://bbpress.trac.wordpress.org/ticket/2454
- Genesis Responsive Slider: http://wordpress.org/support/topic/change-how-resources-are-loaded-to-allow-for-defer-loading