The default way to do things seem to have the comment form below the comments. I'd like to have the form at the top. How do I achieve this?


The comment list is output via wp_list_comments(), and the comment-reply form is output via comment_form(); so, just ensure that you call comment_form() before you call wp_list_comments().

  • Hi Chip. In which file are those calls invoked? – bob Oct 16 '11 at 21:44
  • @bob Your theme has several files that control the presentation of various page types (chart). Posts are usually controlled by single.php unless your theme is doing something fancy with custom post types. Inside single.php you should find calls to both of the functions Chip mentioned. You can edit the file and experiment with placement to get what you want. – dgw Oct 17 '11 at 0:10
  • @bob comment markup is defined in comments.php, which is invoked in the Theme template files via comments_template(). – Chip Bennett Oct 17 '11 at 1:03
  • Thanks. In my case, the 'comments.php' file is present in the theme I'm building, but wordpress isn't using it. It must be falling back to something, because the comment thread and form are still being displayed. Where is the file that wordpress falls back to for displaying comments? – bob Oct 17 '11 at 1:57
  • Legacy support (i.e. WordPress using a "fallback" template-part file) has been deprecated, and should not be relied on. Instead, ensure that single.php, page.php, and any other template file from which you wish to call the comments markup includes the <?php comments_template(); ?> template tag, which is what includes the comments markup in the template file. – Chip Bennett Oct 17 '11 at 2:05

I just needed a temporary solution for one of my pages, and I didn't want to edit my theme files, so I just put this in my page using the "text" tab of the page editor. Maybe it'll help someone else in a similar situation:

window.addEventListener("DOMContentLoaded", function(){
  var respond = document.querySelector("#respond");
  var commentsArea = respond.parentNode;
  commentsArea.insertBefore(respond, commentsArea.firstChild);

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.