If you're embedding a form via the shortcode or the new forms widget, the scripts and CSS should only load on the pages that have forms and not on pages where forms don't exist.
When using a Gravity Form in a third party sidebar widget or embedding it anywhere using the function call, you need to manually enqueue the scripts and CSS by placing a short script block in your theme's functions.php file.
wp_enqueue_script("gforms_ui_datepicker", WP_PLUGIN_URL . "/gravityforms/js/jquery-ui/ui.datepicker.js", array("jquery"), "1.3.9", true);
wp_enqueue_script("gforms_datepicker", WP_PLUGIN_URL . "/gravityforms/js/datepicker.js", array("gforms_ui_datepicker"), "1.3.9", true);
wp_enqueue_script("gforms_conditional_logic_lib", WP_PLUGIN_URL . "/gravityforms/js/conditional_logic.js", array("gforms_ui_datepicker"), "1.3.9", true);
wp_enqueue_style("gforms_css", WP_PLUGIN_URL . "/gravityforms/css/forms.css");
Just like using the shortcode, the conditional logic scripts, datepicker script, form CSS and other elements needed for the full form functionality will be loaded only on pages with a form present.
You can find more information at the URL below
http://www.gravityhelp.com/documentation/embedding-a-form/
Posted 14 years ago on Tuesday September 14, 2010 |
Permalink