Changing labels comment form and comment list


Hi, I would like to change the labels in the comment form How can i achieve that in a child theme.

Further I would like to change the comment list layout for example (remove edit + link links and change date format). How can i achive this?

Screenshots https://cloudup.com/cUD4pKvD8Bg


Hey Bas,

  1. To remove the comment links, you can do beans_remove_action( 'beans_comment_links' );
  2. When it comes to the date format, you would use the dynamic {$output_id}_output filter to change it. Here is an explanation about all the hooks in Beans including how to fine the output filters. Could you give me an example of the date format you are looking for and I will send you a code snippet example?

Thanks,


Thanks Thierry, I would like to change the labels.

For example: add a comment -> add your feedback or submit comment -> submit feedback.

I know where to change that in the main beans theme folder but would like to change this in the child theme.

Date format: Thursday 10 November

Thanks Bas


Hey Bas,

Let's take this too examples to explain the {$output_id}_output filter works. When Beans development mode is enabled, you will see that some text is wrapped in <!--- open output: {$output_id} -->text<!--- close output: {$output_id} -->. For the Add a Comment and Post Comment, look how the html looks. See that Add a Comment is wrapped in beans_comment_form_title_text. When you see that it means that there is a {$output_id}_output available to change the content, for instance beans_comment_form_title_text_output. So here is how you can change the Add a Comment to Add your feedback:

add_filter( 'beans_comment_form_title_text_output', 'example_comment_form_title_text' );

function example_comment_form_title_text( $text ) {
 /**
  * Here the $text variable is "Add a Comment" which can be used if necessaray.
   */

 // You may consider using the WordPress translate() function, if you need the string to be translatable.
  return 'Add your feedback';
}

I will let you apply the same logic to change the Post Comment text which is a good exercise 😉 Let me know if something is unclear!

Have fun,


Got it Thierry, Thanks.

Bas

Write a reply

Login or register to write a reply, it's free!