I am working on a client site which is a very stripped down theme. It has no standard html markups as a result of which the reply box doesn't move upto the place of being just below the comment to which you hit the reply button. Can anyone point me to the minimum markup required? I am trying to add classes one by one.
Trying to explain it better: I click on the reply button, the page reloads and the comment form stays below all the comments list. I want it to make it work like when we click on reply button, then without any page reload, it jumps up there and can be cancelled back to the place. The default what we have in Twentyten
Update: I managed to fix up the markup and now I am using comment_form() but cancel reply button doesn't appear and I am not filtering that out. Any ideas?
Done
So sorry to trouble everyone here. The last issue was fixed by removing the CSS display:none;
( Lesson - DIY Themes sucks unless its what you do! ;) )
I am working on a client site which is a very stripped down theme. It has no standard html markups as a result of which the reply box doesn't move upto the place of being just below the comment to which you hit the reply button. Can anyone point me to the minimum markup required? I am trying to add classes one by one.
Trying to explain it better: I click on the reply button, the page reloads and the comment form stays below all the comments list. I want it to make it work like when we click on reply button, then without any page reload, it jumps up there and can be cancelled back to the place. The default what we have in Twentyten
Update: I managed to fix up the markup and now I am using comment_form() but cancel reply button doesn't appear and I am not filtering that out. Any ideas?
Done
So sorry to trouble everyone here. The last issue was fixed by removing the CSS display:none;
( Lesson - DIY Themes sucks unless its what you do! ;) )
- are you using jQuery? You can easily reproduce what comment-reply.js does with jQuery... – onetrickpony Commented Feb 3, 2011 at 9:49
- No I am using the WordPress comment reply script – Ashfame Commented Feb 3, 2011 at 15:22
4 Answers
Reset to default 5You should really use comment_form() instead of rolling your own.
Still, if you must, make sure that:
- The textarea has id="comment".
- The wrapping container around the entire comment form (probably a DIV) has id="respond".
It is good practice to use comment_form()
(customized via hooks, if needed) over manually putting form together.
For internals of comment reply script and stuff it targets see wp-includes/js/comment-reply.dev.js
.
take a look at comment_form();
and probably add wp_enqueue_script( 'comment-reply' );
in your theme's header.php
- You will have to enqueue
'comment-reply'
script. - Make sure your comment list (single comment markup
li
tag) hasid="comment-12"
. Replace 12 with the correct comment id. Thisli
tag should also display the necessary comment classes. - The li tag should have a children like
<article id="div-comment-<?php echo esc_attr( comment_ID( ) ); ?>" class="comment-body">{{all of the comment elements go here}}</article>
. - The rest of the comment elements(author name, date, reply link etc) everything should be inside that
article
tag.