Skip to content

Instantly share code, notes, and snippets.

@ethangardner
Created October 11, 2011 00:25
Show Gist options
  • Save ethangardner/1276957 to your computer and use it in GitHub Desktop.
Save ethangardner/1276957 to your computer and use it in GitHub Desktop.
Include jQuery and jQuery UI via Wordpress functions.php
// add this to the theme's functions.php
// file between the php tags
if(!is_admin()){
wp_deregister_script('jquery');
wp_register_script('jquery', ('https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js'), false, '1.6.4');
wp_enqueue_script('jquery');
wp_deregister_script('jquery-ui');
wp_register_script('jquery-ui', ('https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js'), false, '1.8.16');
wp_enqueue_script('jquery-ui');
}
@captain-sensible
Copy link

your code really helped though i had a clash between a bootstrap carousel & bounce of child image on home page at: http://www.bimschoolgh.com
this seems to work using code in theme functions.php like :
function bootstrap_jquery_scripts() {
// Register the script
wp_register_script( 'my-script', get_template_directory_uri() . '/bootstrap/js/bootstrap.js', array( 'jquery' ) );
// Enqueue the script:
wp_enqueue_script( 'my-script' );
}
add_action( 'wp_enqueue_scripts', 'bootstrap_jquery_scripts' );
function register()
{
// wp_deregister_script('jquery');
wp_register_script('myjquery', ('https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js'), false, '3.2.1');
wp_enqueue_script('myjquery');
wp_deregister_script('jquery-ui');
wp_register_script('myjquery-ui', ('http://ajax.aspnetcdn.com/ajax/jquery.ui/1.11.4/jquery-ui.js'), false, '1.11.4');
wp_enqueue_script('myjquery-ui');

}
add_action( 'wp_enqueue_scripts', 'register' );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment