Archived topic
Modify text before comments form.
6 replies · Started by Judith on September 7, 2021
My site is a blog, so replies to posts is important. I want to modify the text before the comments form (but leave the form as it is), but can't work out how to do so. I would like the text before the form to read
"Leave a reply.
Your email address will not be published. Required fields are marked (*).
Kind regards,
Judy
Hi Judy,
Can you indicate which specific part of the comments form do you want to place the text/message?
By default, this is the layout of the comments form - https://share.getcloudapp.com/GGupzZ8G
To clarify:
Do you want to replace the "Leave a comment" text?
Or add the text after/before the "Leave a comment"?
Let us know.
Hi, Elvin.
Yes, I want to replace the "Leave a comment" text with the two lines I mentioned.
Kind regards
Judy
We'll have to use PHP snippet code for that.
Try this:
add_filter( 'generate_leave_comment','tu_custom_leave_comment' );
function tu_custom_leave_comment() {
return '<span class="leave-reply-title">Leave a reply.</span><br>
<span class="email-reminder">Your email address will not be published.</span> <span class="email-required">Required fields are marked (*).</span>';
}
Here's how to add PHP snippets - https://docs.generatepress.com/article/adding-php/
I purposely added span tags to the text so you can individually style each sentence. You can change/remove it if you prefer. :D
Elvin, thank you. All done, with code snippets plugin.
Thanks for your prompt assistance. It's so easy when you know what you are doing!
Kind regards, Judy.
No problem. Glad you got it sorted. :D
Thanks. Resolved.(Note I've submitted another query.)