1

I want to insert content, just above the comment template.I have tried all the word-press filters and hooks but failed.

I want to insert the content above the comment template, I mean above all comments.

Thanks

EDIT

function my_fields() {
 echo '<p>action/p>';

}
add_action('comment_notes_before','my_fields'); 

Please see the image-I want to insert content in color part of the image in single.php enter image description here

  • show some code. – codepixlabs Oct 19 '13 at 6:33
  • comment notes before action only works when user is not logged in try comment_form_top – codepixlabs Oct 19 '13 at 6:39
  • I want to insert the content above the comment template, I mean above all comments. - what content: post content? Typical use of comment template is after post content. What's the matter here then? Please elaborate your question with more details and clarify the matter. – Mayeenul Islam Oct 19 '13 at 6:57
  • Added image please check – intekhab khan Oct 19 '13 at 7:15
1

It mainly depends on a theme, whether there is a hook, in which you can call an action.

Simple ways, how to do that:

  1. You insert your code directly into single.php, right above the code calling comments_template(),
  2. You create a hook (e.g. above comments_template()) as do_action('my_hook') and then you hook into it your function add_action('my_hook', 'function_i_want_to_hook')
  3. Or you do the same as steps above, however, working with file, where comments template code resides, i.e. comments.php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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