Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

commented Jan 10, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.