WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Contact Form 7] jquery issue ? (4 posts)

  1. picarda
    Member
    Posted 4 years ago #

    Hello,
    Anyone had an issue with this plug and a theme who use jquery ?
    I use the theme Scroller and when I activate this plugin it mess the slider on the home page.

    Any ideas ?

    Thank you.

  2. dylanpaul
    Member
    Posted 3 years ago #

    It appears that the jQuery slider and the Contact Form 7 plugin's css and/or scripts conflict in Safari and IE, causing the slider to break. This does not appear to be an issue in Firefox.

    By default, Contact Form 7 loads its css and scripts to every page, including the page with your jQuery slider. The easiest way to resolve this is to disable Contact Form 7 from loading its css and scripts to the page that includes your jQuery slider. Or, rather, load the Contact Form 7 css and scripts only to the contact form page(s).

    I found this solution on the website Technically Easy, within the post "How To Load the Contact Form 7 Script for a Contact Page Only." Here's how it works:

    1. Add this code to your functions.php file (which is found in Appearance > Editor > functions.php):

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

    add_action( 'wp_print_styles', 'my_deregister_styles', 100 );
    function my_deregister_styles() {
    if ( !is_page('Contact') ) {
    wp_deregister_style( 'contact-form-7' );
    }
    }

    2. In the above code, change the two instances of 'Contact' within "( !is_page('Contact')" to the name of your contact page. If you have more than one contact page, simply add additional pages separated by a comma, as in ('Contact1','Contact2') etc.

    Hope this helps!

  3. lucasmattioneli
    Member
    Posted 3 years ago #

    It worked like a charm!

    thanks a lot!

  4. jmysona
    Member
    Posted 3 years ago #

    When I added contact-7 form my slide show on home page has stopped working but your solution fixed that.
    Great job thanks

Topic Closed

This topic has been closed to new replies.

About this Topic