Last active
August 29, 2015 14:12
-
-
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
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 | |
/** | |
* 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' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See article at the Bright Nucleus Homepage: