admin管理员组

文章数量:1387333

Sorry for not giving more details here, but has anyone experienced a javascript conflict between superfish.js and the WordPress plugin "contact form 7"?

Basically, I've gone through lots of debugging already and found a guaranteed conflict there, everything else on the site is great.

Should I initialize superfish.js somewhere else on my page since I can't control where the WordPress header initializes contact form 7?

EDIT: Forgot to mention the nature of the conflict - the superfish child ul's won't display when both scripts are active

Sorry for not giving more details here, but has anyone experienced a javascript conflict between superfish.js and the WordPress plugin "contact form 7"?

Basically, I've gone through lots of debugging already and found a guaranteed conflict there, everything else on the site is great.

Should I initialize superfish.js somewhere else on my page since I can't control where the WordPress header initializes contact form 7?

EDIT: Forgot to mention the nature of the conflict - the superfish child ul's won't display when both scripts are active

Share Improve this question asked Feb 10, 2011 at 23:47 BrianBrian 3,95912 gold badges58 silver badges104 bronze badges 2
  • What kind of conflict are you experiencing? – limc Commented Feb 10, 2011 at 23:49
  • good question. Conflict is that superfish child ul's are hidden and don't appear on hover. – Brian Commented Feb 10, 2011 at 23:50
Add a ment  | 

2 Answers 2

Reset to default 6

Got it! jQuery multiple versions being loaded (the plugin was loading an outdated one). In order to de-register jQuery from Contact Form 7 (without editing core files), add the following to functions.php

// De-register jQuery from Contact Form 7

add_action( 'wp_print_scripts', 'my_deregister_javascript', 100 );
function my_deregister_javascript() {
    wp_deregister_script( 'contact-form-7' );
}

With latest version of plugin you can add these lines to your functions.php to stop loading default css/js for the plugin on every page

add_filter( 'wpcf7_load_js', '__return_false' );
add_filter( 'wpcf7_load_css', '__return_false' );

more info here: http://contactform7./loading-javascript-and-stylesheet-only-when-it-is-necessary/

本文标签: jqueryjavascript conflict contact form 7 amp superfishjsStack Overflow