0
wp_enqueue_script('jquery-effects-shake');

..doesn't seem to work, no matter where I put it. I've tried the following and lots of googling:

function my_callback() {
    wp_enqueue_script('jquery-effects-shake');
}
add_action('wp_enqueue_scripts', 'my_callback');

and

<?php
    wp_enqueue_script('jquery-effects-shake');
    get_header(); 
?>

Thanks!

5
  • Related: How Do I Use jQuery UI In My Plugin Commented Oct 18, 2013 at 23:46
  • What does "doesnt work" mean? Have you viewed source to see if the script loads? Or are you saying you can't make a script shake (which could be a whole boatload of other problem) Commented Oct 19, 2013 at 3:15
  • It isn't adding the script to <head>. Commented Oct 19, 2013 at 18:53
  • toscho: That is one of the docs that I read. I am doing the same thing and it's still not adding the script to <head> Commented Oct 19, 2013 at 18:55
  • Is the theme using the wp_head and wp_footer function calls? You said it's not loading in <head>, does that mean it's loading somewhere else or not at all? Commented Oct 25, 2013 at 3:31

1 Answer 1

1

Make sure you are also including the jquery effects core... and jquery if it's not already being loaded.

function my_callback() {
    wp_enqueue_script('jquery');  // If not already loaded
    wp_enqueue_script('jquery-effects-core');
    wp_enqueue_script('jquery-effects-shake');
}
add_action('wp_enqueue_scripts', 'my_callback');
3
  • Shouldn't those be automatically included as Dependencies? Adding them made no difference for me. Commented Oct 19, 2013 at 18:53
  • Are you trying to do this in the admin panel, or in a template file for the front-end of the site? Commented Oct 19, 2013 at 19:15
  • In a template on the front-end of the site. Commented Oct 22, 2013 at 20:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.