Created
October 12, 2024 21:21
-
-
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.
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
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