0

I am working on a site that uses jQuery for a number of functions but I am having a repeating error:

hoverIntent is not a function

I have referenced similar questions on this forum and they almost universally say that it is due to multiple references to jQuery, however, I have carefully reviewed the code and the source code and cannot find any duplicate references.

There is just this one in functions.php

// Load jQuery
if ( !is_admin() ) {
   wp_deregister_script('jquery');
   wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"), false);
   wp_register_script('jquery', ("js/jquery.dropmenu.js"), false);
   wp_register_script('jquery', ("js/jquery.dropmenu2.js"), false);  
   wp_enqueue_script('jquery');
}

I would really appreciate another set of eyes to help pinpoint and resolve this dilemma.

2
  • Are you by any chance enqueuing jquery after the script that depends on it? Commented Jul 25, 2014 at 16:33
  • Good question, but jQuery is listed first. Commented Jul 25, 2014 at 17:22

2 Answers 2

0

According to the wp_register_script() Codex the first parameter handle should have a unique name.

If we look at the paramters of the wp_register_script() function it breaks down like this:

wp_register_script( $handle, $src, $deps, $ver, $in_footer );

So your wp_register_script() function should also break down into a similar way:

wp_register_script( 'dropmenu1', get_bloginfo('template_directory') . '/js/jquery.dropmenu.js', array('jquery'), '', false);
2
  • Howdy, I am not sure how this would be implemented. Does it replace the entire wg_register_script block or just the one with dropmenu in it? I tried both and I still get the error. Commented Jul 25, 2014 at 17:25
  • Where are you putting your current code? Are you using any hooks like wp_enqueue_scripts? This is a good example of how registering and enqueueing works in WordPress Commented Jul 25, 2014 at 17:28
0

I discovered that the HoverIntent is optional for the drop menu plugin. I turned that off and everything is working correctly now.

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.