How to wrap submit button of comment form with div

We can use comment_form function’s submit_button parameter to change submit button HTML.

Default HTML for submit_button is

<input name="%1$s" type="submit" id="%2$s" class="%3$s" value="%4$s" />

You can change your code like this.

$comments_args = array(
   ....

   'submit_button' => '<div class="form-group">
            <input name="%1$s" type="submit" id="%2$s" class="%3$s" value="%4$s" />
        </div>'

   ....
);

Update:

Regarding %1$s , %2$s and so on..

If you take a look at comment_form() source, you can see that submit_button is going through sprintf like this.

$submit_button = sprintf(
  $args['submit_button'],
    esc_attr( $args['name_submit'] ),
    esc_attr( $args['id_submit'] ),
    esc_attr( $args['class_submit'] ),
    esc_attr( $args['label_submit'] )
);

Leave a Comment