Created
April 10, 2017 02:29
-
-
Save RiFi2k/19e109ccb151443801bf4ed7fc9be12c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This filter is executed during form load. When set to true, the form init scripts are loaded | |
// in the footer of the site, instead of the default location of which is in the page | |
// body immediately after the form. | |
add_filter( 'gform_init_scripts_footer', '__return_true' ); | |
// This example dynamically adds a custom class to all text fields | |
add_filter( 'gform_field_css_class', 'custom_class', 10, 3 ); | |
function custom_class( $classes, $field, $form ) { | |
if ( $field->type == 'text' ) { | |
$classes .= ' custom_textfield_class'; | |
} | |
return $classes; | |
} | |
// This filter can be used to prevent scripts and stylesheets being printed when GFCommon::gform_do_shortcode() | |
// processes form shortcodes located in various form settings and confirmations after headers have been sent. | |
// Scripts and stylesheets would be enqueued instead. | |
add_filter( 'gform_disable_print_form_scripts', '__return_true' ); | |
add_filter( 'gform_disable_print_form_scripts', 'disable_print_form_scripts', 10, 2 ); | |
function disable_print_form_scripts( $disable_print_form_script, $form) { | |
if ( $form['id'] == 10 ) { | |
return true; | |
} | |
return $gform_disable_print_form_scripts; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment