Hook/Filter before and after comments

I’m writing a plugin that needs to display a custom link immediately near the comments. I have the option in the plugin admin to display before or after. I’m familiar with the comments_array, but that doesn’t allow me to just add a string of html just before the comments or just after the comments but before the comment form.

the_content
-- ?? custom link before ?? --
comments_array
-- ?? custom link after ?? --
comment_form

2 Answers
2

do_action( 'comment_form_before' ); is called on line 1553 of /wp-includes/comment-template.php, right before the output of the comment form, that should handle that one for you. I’ll update this if I can find the hook before the comments.

edit

It seems like you might be able to modify Walker_Comment (found in the same file as above) to output the first link with __construct or something, but I can’t give you precise implementation at the moment (for lack of time).

Leave a Comment