Skip to content

Instantly share code, notes, and snippets.

View JoryHogeveen's full-sized avatar
👌
Coding

Jory Hogeveen JoryHogeveen

👌
Coding
View GitHub Profile
@JoryHogeveen
JoryHogeveen / movegfjstofooter.php
Last active August 21, 2018 10:29 — forked from eriteric/movegfjstofooter.php
Load gravity forms JS in footer
<?php
// GF method: http://www.gravityhelp.com/documentation/gravity-forms/extending-gravity-forms/hooks/filters/gform_init_scripts_footer/
add_filter( 'gform_init_scripts_footer', '__return_true' );
// solution to move remaining JS from https://bjornjohansen.no/load-gravity-forms-js-in-footer
// Force Gravity Forms to init scripts in the footer and ensure that the DOM is loaded before scripts are executed
add_filter( 'gform_cdata_open', 'wrap_gform_cdata_open', 1 );
function wrap_gform_cdata_open( $content = '' ) {
if ( ! wrap_gform_cdata() ) {
return $content;