Skip to content

Instantly share code, notes, and snippets.

@saas786
Forked from fjarrett/gist:8259070
Created June 5, 2014 05:01
Show Gist options
  • Save saas786/a9e75455d05d83cd6ecd to your computer and use it in GitHub Desktop.
Save saas786/a9e75455d05d83cd6ecd to your computer and use it in GitHub Desktop.
<?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