Last active
September 22, 2017 21:48
-
-
Save frankiejarrett/8259070 to your computer and use it in GitHub Desktop.
This file contains 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
<?php | |
/** | |
* Override the output of the submit button on forms, useful for | |
* adding custom classes or other attributes. | |
* | |
* @param string $button An HTML string of the default button | |
* @param array $form An array of form data | |
* @return string $button | |
* | |
* @filter gform_submit_button | |
*/ | |
function fjarrett_gform_submit_button( $button, $form ) { | |
$button = sprintf( | |
'<input type="submit" class="my-custom-class" id="gform_submit_button_%d" value="%s">', | |
absint( $form['id'] ), | |
esc_attr( $form['button']['text'] ) | |
); | |
return $button; | |
} | |
add_filter( 'gform_submit_button', 'fjarrett_gform_submit_button', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great!
And add classes for text input fields?
Normal is the"length" of the field, medium, small, ...