I'm going to reply (late) since I was looking for an answer to this and decided to tackle it myself.
First, to answer the question "why add a class?"... In my case, I chose to use a UI framework called Foundation to design my most recent theme for my personal blog. I chose it precisely because I like its style for buttons. However, it requires the developer to add a class to an <input>
button, and I didn't realize that couldn't be done in WP until I was almost completely done with the theme!
So, here's what I did. I had to edit the /wp-includes/comment-template.php
file, so use at your own risk because it could be wiped out during a WP upgrade.
After line 1540
(as of version 3.2.1) add the following line:
'class_submit' => 'submit',
Then change line 1576
to the following:
<input name="submit" class="<?php echo esc_attr( $args['class_submit'] ); ?>" type="submit" id="<?php echo esc_attr( $args['id_submit'] ); ?>" value="<?php echo esc_attr( $args['label_submit'] ); ?>" />
Now you have a new default value called class_submit
that can be included in the $args
array parameter on the comment_form()
function:
<?php comment_form(
array(
'class_submit' => __('XXX'),
)
); ?>
Happy Wording!