davecurrierseo
10/1/2015 - 4:02 PM

Gravity Forms Customizations

Gravity Forms

<?php 

// Ternary for get field otherwise $form = 2
$form = get_field('gravity_forms_id') ?: 2; 

?>
 /*   Move gform scripts to footer
------------------------------------------------------------------------- */
// move the scripts to the footer
add_filter( 'gform_init_scripts_footer', '__return_true' );
//now prevent them from firing BEFORE google's CDN copy of jQuery is downloaded
add_filter( 'gform_cdata_open', 'wrap_gform_cdata_open' );
function wrap_gform_cdata_open( $content = '' ) {
$content = 'document.addEventListener( "DOMContentLoaded", function() { ';
return $content;
}
add_filter( 'gform_cdata_close', 'wrap_gform_cdata_close' );
function wrap_gform_cdata_close( $content = '' ) {
  $content = ' }, false );';
return $content;
}

gravity_form($formID, false, false, false, null, true, 1);
/**
 *
 * Where _1 is the id of the form you are targeting.
 *
 **/

add_filter('gform_confirmation_anchor_1', create_function('','return false;'));
function custom_gforms_spinner($src) {
    return get_stylesheet_directory_uri() . '/images/loading.gif';
}
add_filter('gform_ajax_spinner_url', 'custom_gforms_spinner');
add_filter("gform_submit_button", "theme_t_wp_submit_button", 10, 2);
    function theme_t_wp_submit_button( $button, $form ){
        return '<button id="" class="form_button"><span>'. $form["button"]["text"] .'<span class="icon-paperplane-fill"></span></span></button>';
}