Load script only on contact page

Home Forums Jquery Validation for Contact Form 7 Load script only on contact page

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #497628 Reply
    Jane
    Guest

    Hi,
    I’m using your plugin in the pro version and it’s generally running fine. But – just as with Contact Form 7 the script is loaded on every page and post, although it’s only needed for the contact page.

    For Contact Form 7 I found a php-snippet taht I could insert into the functions.php in my childtheme. With this snippet the CF7 scripts are only loaded on the contact page where they are needed.

    That’s the code

    // Deregister Contact Form 7 styles
    add_action( ‘wp_print_styles’, ‘aa_deregister_styles’, 100 );
    function aa_deregister_styles() {
    if ( ! is_page( ‘kontakt-buchen’ ) ) {
    wp_deregister_style( ‘contact-form-7’ );
    }
    }

    // Deregister Contact Form 7 JavaScript files on all pages without a form
    add_action( ‘wp_print_scripts’, ‘aa_deregister_javascript’, 100 );
    function aa_deregister_javascript() {
    if ( ! is_page( ‘kontakt-buchen’ ) ) {
    wp_deregister_script( ‘contact-form-7’ );
    }
    }

    As I’m not a programmer, is there a similar code foryour plugin Jquery Validation for Contact Form7?

    Kind regards

    Jane

Viewing 1 post (of 1 total)
Reply To: Load script only on contact page
Your information: