Posted By

chrisaiv on 09/13/14


Tagged

wordpress


Versions (?)

Wordpress: Fix Gravity Form Error


 / Published in: PHP
 

URL: http://hereswhatidid.com/2013/01/move-gravity-forms-jquery-calls-to-footer/

Gravity Forms by default will write an inline JavaScript call to jQuery on every form you add to a page.

  1. /** ******** ******** ******** ******** ******** ******** ******** ********
  2. * TITLE: Gravity Forms Error
  3. * DESCRIPTION: Gravity Forms by default will write an inline JavaScript call to jQuery on every form you add to a page.
  4. *
  5. * http://hereswhatidid.com/2013/01/move-gravity-forms-jquery-calls-to-footer/
  6. */
  7. //Get Rid of Gravity Scripts
  8. function wpdocs_dequeue_script() {
  9.  
  10. //UserPro jQuery
  11. if(is_front_page()){
  12. //Remove existing jquery
  13. wp_deregister_script('jquery');
  14. wp_dequeue_script('jquery-ui-core');
  15. }
  16.  
  17. //UserPro jQuery UI
  18. wp_deregister_style('userpro-jquery-ui');
  19. wp_dequeue_style('userpro-jquery-ui');
  20. }
  21. add_action( 'wp_print_scripts', 'wpdocs_dequeue_script', 100 );
  22.  
  23. //Push Gravity Forms Launch to the Footer
  24. function init_scripts() {
  25. return true;
  26. }
  27. add_filter('gform_init_scripts_footer', 'init_scripts', 100);

Report this snippet  

You need to login to post a comment.