Wordpress jquery confliction with plugin

Hey guys in advance for your help. I did my research, and I'm a little puzzled by this ...

I am creating a Wordpress website for a client and he will have an electronic store. I am using wp-ecommerce. All store pages load with javascript error:

http://www.thecollectiveclothingco.com/products-page/t-shirts/

jQuery("form.product_form").livequery is not a function
[Break On This Error] jQuery("form.product_form").livequery(function(){ 

After some extensive google age, I believe that I have diagnosed the problem as a conflict script. In other words, WP or the plugin itself serves jquery, and I also enable it for some other things on the site. When I delete the jquery script call, the problem disappears and the store is working fine. But I need this jquery ...

I read about using WP enqeue to fix the problem:

function my_init_method() {
    if (!is_admin()) {
        wp_deregister_script( 'jquery' );
        wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js');
        wp_enqueue_script( 'jquery' );
    }
}    
add_action('init', 'my_init_method');php wp_head(); 

, , , , .

? .

+3
3

jquery noConflict http://api.jquery.com/jQuery.noConflict/

,

var j = jQuery.noConflict();
// Do something with jQuery
j("div p").hide();
// Do something with another library $()
$("content").style.display = 'none';
+2

, , script. wp (); . , , . :

<?php
wp_head();
wp_deregister_script('jquery');
wp_enqueue_script('jquery', MYURL .'http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js', FALSE, '1.4.4');
 ?>
+2

Have you been looking for an answer at https://wordpress.stackexchange.com/ ?

+1
source

Source: https://habr.com/ru/post/1788858/


All Articles