Site logo

Archived topic

Adding text to the Comment Box

3 replies · Started by Forum User on December 23, 2022

Viewing posts 1–4 of 4

Hi,

I'd like to add a text just below the comment box stating that privacy rules apply and a link to my data protection page.
I've tried several things but couldn't get it to work.

I have created a child theme already and tried to adapt the comments.php... Maybe with GP this is not the right way to go?

Could you please give me some advice, how I could easily implement this?

Thanks
Frank

Hi there,

GP uses the core comment_form() function and it has a few Hooks you can use - see here:

https://wpengineer.com/2205/comment-form-hooks-visualized/

you can use them with a GP Hook Element:

https://docs.generatepress.com/article/hooks-element-overview/

1. In Appearance > Elements -> Add New Hook.
2. Add the HTML you want to display.
3. Set the Hook to Custom and add your comment form hook name eg comment form after fields
4. Set the Display Rules to Posts > All Posts.

Note if you want you can use the Block Element instead if you want use blocks for your content.
The same applies as the above.

Thanks a lot for the quick response.
Documentation looks good, but seems to be outdated. Could that be the case?

I have enabled Elements as described here: https://docs.generatepress.com/article/hooks-element-overview/

But I don't have all the options shown here: https://wpengineer.com/2205/comment-form-hooks-visualized/

I'd like to use the comment_form_after hook, but the only hooks the selection list provides to me with regard to comments are:
- generate_before_comments_container
- generate_before_comments
- generate_inside_comments
- generate_below_comments_title

That's it...
Anything wrong with my installation ?

We don't list the core hooks aside from those that are in the GeneratePress templates ( wp_head, wp_body_open, wp_footer ). As the list would be huge and we wouldn't know if those hooks were present in a particular page.

In these cases:

1. Set the Hook to: Custom Hook
2. In the Custom Hook Name field it provides, paste in your hook ie. comment_form_after

This archived topic is closed to new replies.