1

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

2
  • What kind of conflict are you experiencing?
    – limc
    Feb 10, 2011 at 23:49
  • good question. Conflict is that superfish child ul's are hidden and don't appear on hover.
    – Brian
    Feb 10, 2011 at 23:50

2 Answers 2

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' );
}
3
  • Hi, I know this is old but does this only remove the outdated jQuery and not the other necessary Javascript codes of Contact Form 7? I haven't tested this much but so far it works! :)
    – ton
    Oct 7, 2012 at 19:34
  • I'm not sure off the top of my head - but contact form 7 relies entirely on javascript, so if adding this action doesn't prevent contact form 7 from working, then you should be fine. I'm sure the function is only loading jQuery and it's own library and not likely any others. Just test validation by entering something in the form that fails validation.
    – Brian
    Oct 8, 2012 at 19:44
  • Sorry, I carelessly clicked the upvote. I was busy and was able to test it just now... Adding that to the functions.php made the contact form not functioning. :-/
    – ton
    Oct 9, 2012 at 5:53
1

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.com/loading-javascript-and-stylesheet-only-when-it-is-necessary/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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