3

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

4

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).

1
  • Yes, I was able to use the do_action to at least place the html before the form, after the comments_array.
    – Beer
    Jan 16, 2012 at 15:26
8

I think, this is the post, that you search; all hooks on comments form visualized: http://wpengineer.com/2205/comment-form-hooks-visualized/

alternativ all hooks:

  • comment_form_before
  • comment_form_top
  • comment_form_before_fields
  • comment_form_after_fields
  • comment_form
  • comment_form_after
1
  • 2
    Thanks, it's a nice way to visualize those hooks but they're all about the comment_form and I needed to place html before/after the comments_array.
    – Beer
    Jan 16, 2012 at 15:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.