Skip to main content
2 of 6
More details
rflw
  • 166
  • 2
  • 9

Flexslider won't work with WordPress' jQuery

When I try to use the Flexslider with 'built-in' jquery, the Flexslider won't work. When I use my own myjquery file, It works as if nothing ever.
Do I always have to use my own jquery file even wordpress has its own?

  • Wordpress' (built in) jQuery vserion: 1.11.3
  • Flexbox required jQuery version: 1.7+
  • myjquery = jquery version: 1.12.0

Summary: flexbox should work with jQuery of WordPress.


Briefly

Flexslider doesn't work when I use Wordpress' jQuery. It works when I add my own myjquery.js which is jquery 1.12.0 and when I dequeue original jquery wp_dequeue_script('jquery');.

wp_register_script( 'bootstrap-js', get_template_directory_uri() . '/bootstrap/js/bootstrap.js' );
wp_register_script( 'myjquery', get_template_directory_uri() . '/js/jquery.js' );
wp_register_script( 'flexslider', get_template_directory_uri() . '/js/flexslider.js', array('jquery'), false, true );
wp_register_script( 'custom-js', get_template_directory_uri() . '/js/custom.js', array('flexslider'), false, true );

// Enqueue :: styles & scripts
function mytheme_enqueue_items() {
  wp_enqueue_style( 'my-main-css' );
  wp_enqueue_style( 'bootstrap-css' );
  wp_enqueue_style( 'bootstrap-responsive' );
  wp_enqueue_style( 'flexslider-css' );

  // wp_enqueue_script( '**myjquery**' ); // **flexslider works correctly when uncommented**
  wp_enqueue_script( 'bootstrap-js' );
  wp_enqueue_script( 'flexslider' );
  wp_enqueue_script( 'custom-js' );
}
add_action( 'wp_enqueue_scripts', 'mytheme_enqueue_items' );
rflw
  • 166
  • 2
  • 9