[Resolved] Changing "Leave a Reply" Twenty Eleven
I tried that to change the wording “Leave a Reply” that appears below the post. What I would like is to change the wording inside the Comment/Reply Box. Thank you though.
You can add some code to the comment.php
I didn’t like the “Leave a Reply” text either and wanted to personalize the message to match my personality.
If you’re using a child theme, you’ll need to copy the comment.php file over so your child theme can use it otherwise, if you change the parent, the changes may reset to the default during an update.
Change the line of code in the original comment php from
<?php comment_form(); ?>
to something like this only change the text inside the single quote mark Comments Make Me Happy to whatever you like.
<?php comment_form(array(‘title_reply’=>’Comments Make Me Happy’)); ?>
BTW-I found the line of code towards the bottom of the Twenty Eleven theme file.
Thank you JennAtFFP. I also found another way to change the title in the comment form of the Twenty Eleven theme. It’s via FTP, opening and changing the file ‘comment-form.php’ in the /wp-include/ folder. There is a line of code that explicitly says “title_reply =>…’.
Thank you guys for your help.
The thread was resolved.
To be more precise, the file riledesmag refers to is called “comment-template.php” and it’s inside the “wp-includes” folder. The form to edit is at the bottom of the comment-template.php page.
That is, if using wp 3.2.1. Otherwise you’ll be wasting time – like me, looking for a file that does not exist.
Another question. How can I change the wording “Leave a Reply” into Cyrillic “Добавить комментарий”? I created the child comments.php-file, but the php-syntax doesn’t understand things like <?php comment_form(array(‘title_reply’=>’Добавить комментарий’)); ?>
Oh! Sorry. That was simple: just to change the encoding from ANSI into UTF-8.
JennAtFFP has the best answer to the original question. It is best to avoid editing core files or parent theme files that may get overwritten with each update.
Creating the array can be a little tricky. You can find the variables around line 1525 of /wp-includes/comment-template.php, but don’t edit that file directly. Use a copy of comments.php in your child theme.
Here is another example that changes the “leave a reply” text, the message below it, and includes a variable for the required fields text.
<?php $required_text = sprintf( ‘ ‘ . __(‘Required fields are marked %s’), ‘<span class=”required”>*</span>’ ); comment_form(array(‘title_reply’=>’Leave a note…’,’comment_notes_before’=>'<p class=”comment-notes”>’ . __( ‘Your email address will not be published or shared.’ ) . ( $req ? $required_text : ” ) . ‘</p>”)); ?>
Could anyone assist me with combining the code JennAtFFP provided for changing the comment form title, but also changing the other labels, plus, eliminating the website field altogether.
Here is the code I found that will change everything except the comment form title:
<?php $comment_args = array( 'fields' => apply_filters( 'comment_form_default_fields', array( 'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Your Name' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) . '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' />' . '</p><!-- #form-section-author .form-section -->', 'email' => '<p class="comment-form-email">' . '<label for="email">' . __( 'Your Email' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) . '<input id="email" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' />' . '</p><!-- #form-section-email .form-section -->', 'url' => '' ) ), 'comment_field' => '<p class="comment-form-comment">' . '<label for="comment">' . __( 'Let us know what you have to say:' ) . '</label>' . '<textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea>' . '</p><!-- #form-section-comment .form-section -->', 'comment_notes_after' => '', ); comment_form($comment_args); ?>
and, of course here is the code for changing the title:
<?php comment_form(array('title_reply'=>'Comments Make Me Happy')); ?>
I just need to know how to add the two together.
- The topic ‘[Resolved] Changing "Leave a Reply" Twenty Eleven’ is closed to new replies.