Skip to content

Instantly share code, notes, and snippets.

@schlessera
Last active August 29, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schlessera/f1b29f8210627089bc8e to your computer and use it in GitHub Desktop.
Save schlessera/f1b29f8210627089bc8e to your computer and use it in GitHub Desktop.
Add one or more classes to the WordPress comment form's 'Submit' button
<?php
/**
* Add one or more classes to the WordPress comment form's 'Submit' button
* NB: This only works as of WordPress 4.1
* @author Alain Schlesser (alain.schlesser@gmail.com)
* @link http://www.brightnucleus.com/add-class-wordpress-comment-submit-button/
*
* @param array $arg contains all the default values used by the comment form
* @return array modified array that goes back to the comment renderer
*
* @see http://codex.wordpress.org/Function_Reference/comment_form
* @see http://developer.wordpress.org/reference/hooks/comment_form_defaults/
*/
function as_adapt_comment_form( $arg ) {
// $arg contains all the comment form defaults
// simply redefine one of the existing array keys to change the comment form
// see http://codex.wordpress.org/Function_Reference/comment_form for a list
// of array keys
// add Foundation classes to the button class
$arg['class_submit'] = 'button radius';
// return the modified array
return $arg;
}
// run the comment form defaults through the newly defined filter
add_filter( 'comment_form_defaults', 'as_adapt_comment_form' );
?>
@schlessera
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment