0

I use the Twenty Ten theme, customized.

The theme text is: Your email address will not be published.

With the email box below, this gives readers the impression that they must enter an email address, yet I set my settings so one is not required.

I'd like to edit the text to read:

You do not have to leave an email address in order to reply.

Can this be done? If so, how?

Thank you.

2

At the bottom of comments.php, replace:

<?php comment_form(); ?>

with:

<?php comment_form(array('comment_notes_before' => 'You do not have to leave an email address in order to reply.')); ?>
  • Thanks, Gavin, but that didn't fix it. Text remains the same. – Avery Aug 9 '11 at 3:40
  • 1
    That certainly works - just tested it out. Maybe ensure that your comments.php is what is being used to display the comments box? – GavinR Aug 9 '11 at 12:53
  • @:Avery : check your file correctly.@:GavinR :is correct.:) – Ramkumar M Sep 29 '11 at 9:40
2

Place this code at the end of your child themes functions.php file. You can change the placeholder text for each field to suit your own needs.

    function wpsites_modify_comment_form_fields($fields){

$fields['author'] = '<p class="comment-form-author">' . '<label for="author">' . __( 'Author', 'wpsites.net' ) . '</label> ' . 

( $req ? '<span class="required">*</span>' : '' ) .

'<input id="author" name="author" type="text" placeholder="Real name, please, no keyword spamming!" value="' . 

esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></p>';

$fields['email'] = '<p class="comment-form-email"><label for="email">' . __( 'Address', 'wpsites.net' ) . '</label> ' .

( $req ? '<span class="required">*</span>' : '' ) .

'<input id="email" name="email" type="text" placeholder="You do not have to leave an email address in order to reply" value="' . 

esc_attr(  $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></p>';

$fields['url'] = '<p class="comment-form-url"><label for="url">' . __( 'Domain', 'wpsites.net' ) . '</label>' .

'<input id="url" name="url" type="text" placeholder="Please Link To Your Own Domain" value="' . 

esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></p>';

return $fields;
    }

    add_filter('comment_form_default_fields','wpsites_modify_comment_form_fields');

Source http://wpsites.net/web-design/customize-comment-form-place-holder-input-text-fields-labels/

Or you can modify the comment note before using this code in your child themes functions file.

    function wpsites_modify_text_before_comment_form($arg) {
$arg['comment_notes_before'] = '<p class="comment-notes">' . __( 'You do not have to leave an email address in order to reply.' ) . '</p>';
return $arg;
    }

    add_filter('comment_form_defaults', 'wpsites_modify_text_before_comment_form');

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