• Resolved darthyoda6

    (@darthyoda6)


    Sorry to bug you again, but I was wondering if you can change your enqueue scripts to require CF7 to also be a requirement before loading?

    So change

    wp_enqueue_script('wpcf7cf-scripts', plugins_url('js/scripts.js', __FILE__), array('jquery'), WPCF7CF_VERSION, true);
    
    wp_enqueue_style('cf7cf-style', plugins_url('style.css', __FILE__), array(), WPCF7CF_VERSION);'
    
    to 
    
    

    wp_enqueue_script(‘wpcf7cf-scripts’, plugins_url(‘js/scripts.js’, __FILE__), array(‘jquery’, ‘contact-form-7’), WPCF7CF_VERSION, true);

    wp_enqueue_style(‘cf7cf-style’, plugins_url(‘style.css’, __FILE__), array(‘contact-form-7’), WPCF7CF_VERSION);`

    That way we can have CF7 & all related plugins only load on form pages and not the whole website, using CF7’s removal method.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jules Colle

    (@jules-colle)

    I changed this a couple of times already. But I think this is the only workable way for most people. The reason is this:

    Some plugins (like the paypal+stripe extension) are suppressing the CF7 scripts by default, causing a form reload instead of ajax submit. However, Conditional Fields scripts still work fine without the CF7 script. In 1.5 I did an update to make the scripts load only if CF7_LOAD_JS was true, but this was causing the paypal plugin to malfunction. So I moved it back to wp_enqueue_script.

    What you can do if you don’t want the conditional scripts to load is set WPCF7CF_LOAD_JS to false.

    Thread Starter darthyoda6

    (@darthyoda6)

    Then would it be possible to add a WPCF7CF_LOAD_CS as well so we can block the css on non form pages?

    Plugin Author Jules Colle

    (@jules-colle)

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘CF Conditional fields load scripts when CF7 not loaded’ is closed to new replies.