Skip to content

Instantly share code, notes, and snippets.

@codenameEli
Created February 1, 2017 20:14
Show Gist options
  • Save codenameEli/1e4003ca4d73aa96d60e624ef507ab7e to your computer and use it in GitHub Desktop.
Save codenameEli/1e4003ca4d73aa96d60e624ef507ab7e to your computer and use it in GitHub Desktop.
Add your own custom class to Gravity Forms fields. Much easier to do than having the client go into the backend and add a class through the Form Edit screen.
<?php
add_filter( 'gform_field_css_class', 'chronos_add_custom_field_class', 10, 3 );
function chronos_add_custom_field_class( $classes, $field, $form )
{
$classes .= ' chronos-' . $field->type . '-field';
return $classes;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment