Thare are no errors in the JS console. My goal is to use the shipped version of jQuery that Wordpress uses to work with bxslider. According the link shown here, the current version of jquery shipped with wordpress 4.0 is 1.11.1, the same version I'm using when I'm testing it by deregistering the default version. However, themeforest guidelines outline that "Authors are not allowed to deregister the default version of jQuery and load another one" and "Themes will be required to use whichever version of jQuery ships with the current version of WordPress." Is there a reason why one way works but not the other?

What I've already tried: wp_enqueue_script('jquery');

wp_register_script('gallery-script', MALEFICENT_PATH . '/js/jquery.bxslider.min.js', array('jquery'), null, true);

What's happening is that the 3 images that I have in place are no longer displayed in a slider when I remove the deregister script and add the following above. What I have below works, but this involves deregistering the default jquery from Wordpress.

I currently have the following that WORKS:

function register_frontend_javascript()
// Deregister the included library

// Register the library again from Google's CDN
wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js', array(), '1.11.1', false);

// Register the script like this for a theme:
wp_register_script('gallery-script', MALEFICENT_PATH . '/js/jquery.bxslider.min.js', array(), null, true);
wp_register_script('main-script', MALEFICENT_PATH . '/js/main.js', array('jquery'), null, true);
wp_register_script('modernizer', MALEFICENT_PATH . '/js/modernizr.js', array(), null, false);
wp_register_script('foundation', MALEFICENT_PATH . '/js/foundation.min.js', array('jquery'), null, true);

// For either a plugin or a theme, you can then enqueue the script:
wp_enqueue_script(array('gallery-script', 'main-script', 'modernizer', 'foundation'));
add_action('wp_enqueue_scripts', 'register_frontend_javascript');

Any help would be greatly appreciated.

  • The problem is most likely in your main.js, not in bxslider. Make sure you use jQuery, not $, or that you use a proper noConflict wrapper. – Otto Sep 23 '14 at 18:40
  • Appreciate the reply! The problem was in fact in main.js. Problem is solved. – Bernard Ma Sep 23 '14 at 18:41

The jQuery library packed with WordPress, operates under noConflict mode. Means you can not use $ in your jQuery snippet/code. Either use jQuery instead of $.

or use noConflict wrapper like this.

<script type="text/javascript">
    jQuery(document).ready(function($) {

        // your jquery function, you can use $ here.

  // -->
| improve this answer | |
  • My pleasure, glad it worked. Enjoy :-) – Robert hue Sep 23 '14 at 18:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.