Zia Bablu Zia Bablu - 1 year ago 64
jQuery Question

wordpress jquery is not responding as dependency

I have converted a html ecommerce template into woocommerce. but it is not working properly.the nivo slider and some other product is not working. maybe they are not finding wordpress jquery. although I enqueue custom jquery and other js file. here are the nivo slider js code below.

$(document).ready(function() {


its dependencies is jquery 1.7.1

Answer Source

First of all, if there's an issue with jQuery like $ is not defined then you need to use jQuery instead of $. Your new code will be

jQuery(document).ready(function($) {

Now, if you need a jQuery version other than the one WP uses. You can deregister and enqueue your specific jQuery again. Add this to your functions.php file

add_action( 'wp_enqueue_scripts', function(){
    wp_dequeue_script( 'jquery' );
    wp_deregister_script( 'jquery' );

    wp_register_script( 'jquery', 'URL_OF_YOUR_NEW_JQUERY_FILE', array(), NULL, false );
    wp_enqueue_script( 'jquery' );
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download