Reece
Reece

Reputation: 2711

WordPress plugin jQuery overriding mine

I have installed contact form 7 and since doing so my slick slider no longer works. I believe this is because the jQuery that contact form 7 uses is out dated and overriding mine. I'm not using the slick slider plugin I just downloaded the files instead like you would with a none WP site. How can I stop this happening?

Upvotes: 0

Views: 85

Answers (2)

Tomasz Bakula
Tomasz Bakula

Reputation: 161

If you're using the latest version of WordPress and jQuery has been enqueued correctly you shouldn't have any conflicts.

jQuery should be passed as a dependency in the wp_enqueue_script() and then you don't have to load it manually.

Here is an example:

add_action( 'wp_enqueue_scripts', function () {

    wp_enqueue_script( 'slick-js', get_template_directory_uri() . '/js/slick.js', array( 'jquery' ), '1.0.0', true  );

} );

Upvotes: 1

Gnanasekaran Loganathan
Gnanasekaran Loganathan

Reputation: 1108

use jQuery conflict functionality for avoid conflict between jQuery library,

<script type="text/javascript">
  $.noConflict();
  // Code that uses other library's $ can follow here.
</script>

Upvotes: 0

Related Questions