PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Deregister Scripts / CSS

  1. Hello, I'm building a mobile site using gravity forms, which means I'm using the gravity forms in another theme at the same time.

    I'm basically using gravity in two themes simultaneously - and in my mobile theme I need to deregister the scripts/css.

    But I cant find the handle's for the css or the script.

    Can you please tell me what they both are so I can deregister them,

    Many Thanks
    Josh

    Posted 12 years ago on Wednesday August 10, 2011 | Permalink
  2. I realize the gravity forms will not work if I de-register the scripts, but It's just for reference.

    Posted 12 years ago on Thursday August 11, 2011 | Permalink
  3. I think what you really want is to de-register the css. You can do that with the following code snippet:

    add_action("gform_enqueue_scripts", "deregister_style");
    function deregister_style(){
        wp_deregister_style("gforms_css");
    }

    Gravity Forms only enqueues the scripts that it needs. For example, if you select a date-picker field, the datepicker.js script will be enqueued. If you use conditional logic, the conditional_logic.js script will be enqueued. If you don't select any feature that requires client side scripting, no scripts will be enqueued. So the best way to prevent client scripts from being enqueued is to simply not use fields/features that require client side scripts.
    Having said that, the following code snippet will de-register all scripts that can possibly be enqueued by Gravity Forms:

    add_action("gform_enqueue_scripts", "deregister_scripts");
    function deregister_scripts(){
        wp_deregister_script("gforms_conditional_logic_lib");
        wp_deregister_script("gforms_ui_datepicker");
        wp_deregister_script("gforms_gravityforms");
        wp_deregister_script("gforms_character_counter");
        wp_deregister_script("gforms_json");
        wp_deregister_script("jquery");
    }
    Posted 12 years ago on Thursday August 11, 2011 | Permalink
  4. Hi Alex,

    Thanks for you quick response.

    This information has been extremely helpful.

    I deregistered the CSS and the jQuery mobile framework totally took over and looked great.

    I added about 5 css selectors in my style sheet to remove some padding and list-styles.

    Worked a treat - thanks!!!

    Posted 12 years ago on Friday August 12, 2011 | Permalink
  5. Thanks for the update provdes.

    Posted 12 years ago on Friday August 12, 2011 | Permalink

This topic has been resolved and has been closed to new replies.