Enqueue Jquery

This is how to enqueue jquery and several other scripts that depend on jQuery. Paste the following into your functions.php file:

/**
* Add jQuery
*/
function add_jquery_script() {
wp_deregister_script( ‘jquery’ );
wp_register_script( ‘jquery’, ‘https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js’);
wp_enqueue_script( ‘jquery’ );
}
add_action(‘wp_enqueue_scripts’, ‘add_jquery_script’);

function my_scripts_method() {
wp_enqueue_script(
‘custom-script’,
get_template_directory_uri() . ‘/js/theme.script.js’,
array( ‘jquery’ )
);
wp_enqueue_script(
‘jquery-easing’,
get_template_directory_uri() . ‘/js/jquery.easing.1.3.js’,
array( ‘jquery’ )
);
}

add_action( ‘wp_enqueue_scripts’, ‘my_scripts_method’ );

Leave a Reply