Archived topic
Change comment section to say "comments" instead of "thoughts"
9 replies · Started by Jordan on April 9, 2019
How can I make the comment section at the bottom say "comments" instead of "thoughts" on this page https://weseekdiscovery.com/best-van-life-essentials/?
Hi there,
you can use this PHP Filter here:
https://docs.generatepress.com/article/generate_comment_form_title/
Thanks!
You're welcome
This is a very incomplete answer!
The default seems to be:
1 thought on “Title”
n thoughts on “Title”
Changing the filter to be "What do others say" doesn't account for the case of just one, or more than one, comment, and in any case definitely doesn't answer the original question: how to change the specific word "thought" to the specific word "comment" -- with the plural added as appropriate -- which is what I was also looking for to find this.
(Not to mention, I also tested the linked function, and it did not change the form title in any way....)
Here's what I did that worked: 1) Make sure my child theme has comments.php in it (if not, copy it over from the parent theme). Edit that to change "thought" (in three places) to whatever you wish, such as "comment". Done.
The filter should work :)
But yes child theme method you did works well too.
Thanks for sharing!
A little reverse engineering lead me to a solution that doesn't require copying comments.php:
function al_generate_comment_form_title ($szString)
{
$szString = str_replace ('thoughts', 'comments', $szString);
return $szString;
}
add_filter( 'generate_comment_form_title', 'al_generate_comment_form_title');
The "trick" is that the filter function is actually passed the title string, which it can then modify and return.
Enjoy,
Leo
SHouldn't need to copy comments.php when using this filter:
https://docs.generatepress.com/article/generate_comment_form_title/
Unless I'm missing something?
Hmmm... who's right? Leo or Leo?
:-D
Haha :)