3

How to change submit button value in comment from "Post Comment" to "Send" I have "responsive" theme , I tried to seach files in wp folder but i can't find the html for this form .

Also Is that Possible to change this value (html Attribute) through CSS ?

below is the code of comment.php file

<?php if ( comments_open() ) : ?>

    <?php
    $fields = array(
        'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name', 'responsive' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) .
        '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" /></p>',
        'email'  => '<p class="comment-form-email"><label for="email">' . __( 'E-mail', 'responsive' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) .
        '<input id="email" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30" /></p>',
        'url'    => '<p class="comment-form-url"><label for="url">' . __( 'Website', 'responsive' ) . '</label>' .
        '<input id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></p>',
    );

    $defaults = array( 'fields' => apply_filters( 'comment_form_default_fields', $fields ) );

    comment_form( $defaults );
    ?>


<?php endif; ?>
3

Open comments.php file inside your theme's folder

<?php if ( comments_open() ) : ?>

<?php
$fields = array(
    'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name', 'responsive' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) .
    '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" /></p>',
    'email'  => '<p class="comment-form-email"><label for="email">' . __( 'E-mail', 'responsive' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) .
    '<input id="email" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30" /></p>',
    'url'    => '<p class="comment-form-url"><label for="url">' . __( 'Website', 'responsive' ) . '</label>' .
    '<input id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></p>',
);

$defaults = array( 'fields' => apply_filters( 'comment_form_default_fields', $fields ),'label_submit'=>__('Send') );

comment_form( $defaults );
?>

The comment_form() function is responsible to display the comment form.

It's argument is an array.

The $default you see in the code is an array which contains other arrays as it's items.

The 'fields' items takes array for input fields The 'label_submit' is used to change the label for submit button

You can read more at codex.wordpress.org/Function_Reference/comment_form

  • i find comment_form but with different implementation , kindly check my code above – Bassem Dec 15 '14 at 8:54
  • I've edited the above code. Check now. – Karun Dec 15 '14 at 9:02
  • Good , worked fine , thanks alot , not only i need to done a task but also I need to understand so could you please clarify the above code please . – Bassem Dec 15 '14 at 9:08
  • The comment_form() function is responsible to display the comment form. It's argument is an array. The $default you see in the code is an array which contains other arrays as it's items. The 'fields' items takes array for input fields The 'label_submit' is used to change the label for submit button You can read more at codex.wordpress.org/Function_Reference/comment_form – Karun Dec 15 '14 at 9:11
  • Is that enough ? :D , any way thanks – Bassem Dec 15 '14 at 9:13

protected by Community Aug 21 '18 at 5:18

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.