Skip to content

Instantly share code, notes, and snippets.

@pixelstorm
Created October 12, 2024 21:21
Show Gist options
  • Save pixelstorm/453b2d2c8b7c4ea4913ba5d52dd84f2b to your computer and use it in GitHub Desktop.
Save pixelstorm/453b2d2c8b7c4ea4913ba5d52dd84f2b to your computer and use it in GitHub Desktop.
Customise your gravity form submit function by adding this code to your functions php file.
add_filter( 'gform_submit_button', 'add_custom_css_classes', 10, 2 );
function add_custom_css_classes( $button, $form ) {
$dom = new DOMDocument();
$dom->loadHTML( $button );
$input = $dom->getElementsByTagName( 'input' )->item(0);
$classes = $input->getAttribute( 'class' );
$classes .= " btn btn--primary";
$input->setAttribute( 'class', $classes );
return $dom->saveHtml( $input );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment