MeltingDog
MeltingDog

Reputation: 15404

Include JQuery and JQuery UI in Wordpress header.php

Ive tried a lot of versions of doing this I have found on SO and the net but none have worked for me.

I am running version 3.4.2. Perhaps there is a different way of doing it for this version?

My code is:

<?php
function my_scripts_method() {
  wp_enqueue_script( 'jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js' );
  wp_enqueue_script( 'jquery-ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.8/jquery-ui.min.js' );

}

add_action( 'wp_enqueue_scripts', 'my_scripts_method' );
?>

I have this just above the </head> tag.

Can anyone help me out and tell me where I am going wrong?

Upvotes: 0

Views: 1498

Answers (1)

michalzuber
michalzuber

Reputation: 5215

Had similiar issue and I fixed it first deregister, register it to your value and than enqueue

At http://codex.wordpress.org/Function_Reference/wp_register_script

If you try to register or enqueue an already registered handle with different parameters, the new parameters will be ignored. Instead, use wp_deregister_script() and register the script again with the new parameters.

wp_deregister_script('jquery');
wp_register_script('jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js');
wp_enqueue_script('jquery');

wp_deregister_script('jquery');
wp_register_script('jquery-ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.8/jquery-ui.min.js');
wp_enqueue_script('jquery');

Upvotes: 1

Related Questions