Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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! ;) )

share|improve this question
    
are you using jQuery? You can easily reproduce what comment-reply.js does with jQuery... –  onetrickpony Feb 3 '11 at 9:49
    
No I am using the WordPress comment reply script –  Ashfame Feb 3 '11 at 15:22

3 Answers 3

up vote 2 down vote accepted

You should really use comment_form() instead of rolling your own.

Still, if you must, make sure that:

  1. The textarea has id="comment".
  2. The wrapping container around the entire comment form (probably a DIV) has id="respond".
share|improve this answer
    
Yes Otto I totally understand the benefits of using comment_form() but in this case I must fix this up as it is as its someone else mess and I am not up for a cleanup. I checked the textarea does have id="comment" & the comment form is wrapped up in DIV id="respond" but it still doesn't move up on clicking the reply button & the page reloads –  Ashfame Feb 3 '11 at 14:52
    
Small issue remains that 'Cancel reply' link doesn't appear when I am using comment_form() and I am not filtering it out. –  Ashfame Feb 3 '11 at 20:45
    
This seems to be the most logical answer if someone come searching for the same problem, so I am marking this as the answer. –  Ashfame Feb 3 '11 at 20:57
    
Are you enqueueing the comment-reply javascript as well? As for the cancel, you'll need to add the cancel_comment_reply_link() function in there as well. Try going through this post I wrote a couple years ago for all these details: ottopress.com/2008/wordpress-2-7-comments-enhancements –  Otto Feb 5 '11 at 9:15

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.

share|improve this answer
    
Yes I agree but I am just fixing this up for a client so can't clean up the mess. –  Ashfame Feb 3 '11 at 14:17
    
Small issue remains that 'Cancel reply' link doesn't appear when I am using comment_form() and I am not filtering it out. –  Ashfame Feb 3 '11 at 20:48

take a look at comment_form();

and probably add wp_enqueue_script( 'comment-reply' ); in your theme's header.php

share|improve this answer
    
I have the script loaded. I need to find out what class it targets in the html –  Ashfame Feb 2 '11 at 22:32
    
What do you mean by "what class it targets"? –  Bainternet Feb 2 '11 at 23:03
    
Like $("#main") targets main ID –  Ashfame Feb 3 '11 at 14:12
    
so you want to ajax submit your comments? –  Bainternet Feb 3 '11 at 15:34
    
No I want the default Twentyten functionality. Comment form jumps up to the comment we are replying. Right now this doesn't happen & page reloads –  Ashfame Feb 3 '11 at 16:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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