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! 😉 )
You should really use comment_form() instead of rolling your own.
Still, if you must, make sure that:
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'comment-reply'
script.li
tag) hasid="comment-12"
. Replace 12 with the correct comment id. Thisli
tag should also display the necessary comment classes.<article id="div-comment-<?php echo esc_attr( comment_ID( ) ); ?>" class="comment-body">{{all of the comment elements go here}}</article>
.article
tag.