0

I have a WordPress site that uses the jQuery Mega Menu plugin and theme-my-login both call:

<script type='text/javascript'src='http://localhost/wadhaa/dynamic/wp-includes/js/jquery/jquery.js?ver=1.11.0'></script>

in my head section by:

<?php
    /* Always have wp_head() just before the closing </head>
     * tag of your theme, or you will break many plugins, which
     * generally use this hook to add elements to <head> such
     * as styles, scripts, and meta tags.
     */
    wp_head();
   ?>

and I have to include:

<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>

which causes conflicts with WordPress jquery.js

Can anyone can help me fix this? or let me know at least why this conflict happen.

The error I get from this conflict is:

Uncaught TypeError: undefined is not a function
Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Shreif A.
  • 39
  • 1
  • 10

1 Answers1

0

You don't need to include your own jQuery, Wordpress have included it, but the $ name was reserved.

just call:

jQuery(function($) {
    $('#what_ever_you_want').do_something();
});
Alfred Huang
  • 17,654
  • 32
  • 118
  • 189