Today I realized that since version 2.7 Wordpress started to have build-in Thread Comment Reply Support. But the theme I’m using doesn’t support it.
So, I migrated it myself.
First some changes in comments.php
post_password)) { // if there's a password if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie ?> This post is password protected. Enter the password to view comments. <!-- You can start editing here. --> <h3 id="respond" class="post">Leave a Reply</h3> // comments are closed <h2 class="nocomments post">Comments are closed.</h2> You must be <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>">logged in</a> to post a comment. <div id="respond"> <form id="commentform" action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post"> Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"></a>. <a title="Log out of this account" href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout">Log out »</a> <input id="author" class="text" name="author" size="23" type="text" value="<?php echo $comment_author; ?>" tabindex="1" /> <label for="author"><small>Name </small></label> <input id="email" class="text" name="email" size="23" type="text" value="<?php echo $comment_author_email; ?>" tabindex="2" /> <label for="email"><small>Mail (will not be published) </small></label> <input id="url" class="text" name="url" size="23" type="text" value="<?php echo $comment_author_url; ?>" tabindex="3" /> <label for="url"><small>Website</small></label> <strong>XHTML:</strong> You can use these tags: <textarea id="comment" class="text textarea" cols="100%" rows="10" name="comment"></textarea> <input id="submit" class="btn submit btn-<?php echo $style; ?>" name="submit" type="submit" value="Submit" tabindex="5" /> ID); ?> <div id="cancel-comment-reply"> <span class="teal weight-bold verdana block large"><small></small></span></div> </form></div>
Wordpress2.7 has a function called wp_list_comments() to handle the thread comments. Since it needs to be customized, the callback argument must be used.
Add stuff in function.php
function x_comment($comment, $args, $depth) { $GLOBALS['comment'] = $comment; ?> <li> id="li-comment-"> <div id="comment-<?php comment_ID(); ?>"> <div class="comment-author vcard"> %s<span> <span class="says">says:</span>'), get_comment_author_link()) ?></span></div> comment_approved == '0') : ?> <em> </em> <span class="small verdana light">on </span> <div class="reply"> <span class="teal weight-bold verdana block large"> $depth, 'max_depth' => $args['max_depth']))) ?></span></div> </div> <strong>Add stuff in hearder.php before wp_head() was called to have the required js enbable</strong> <pre lang="php">if ( is_singular() ) wp_enqueue_script( 'comment-reply' );
Some changed to style.css
/* 00 - COMMENTS /* ----------------------------------------------*/ .alt { margin: 0; padding: 10px; } .commentlist { padding: 0; text-align: justify; line-height: 1.4em; } .commentlist li { margin: 15px 0 10px; padding: 5px 5px 10px 10px; list-style: none; } .commentlist li ul li { margin-right: -5px; margin-left: 10px; } .commentlist p {margin: 5px 5px 5px 0;} .children {padding: 0;} #commentform p {margin: 5px 0;} .nocomments { text-align: center; margin: 0; padding: 0; } .commentmetadata { margin: 0; display: block; } .commentlist li .avatar { float: right; border: 1px solid #EEEEEE; padding: 2px; background: #FFFFFF; } .thread-alt{background: #EDEDEE;} .commentlist .even, .alt {border-left:10px solid #CCCCCC;} .commentlist .depth-1 { border:1px solid #DDDDDD;}
Install and configure HGK SMTP and Comment Reply Notification.
Well done!


哈哈,终于成功啦,谢谢
@tsestrong: 这个要看你用的是什么主题了,我当时发这篇文章的时候还不是用的这个主题。
你好,我按你的做法配置了,还是不行呢。
Good work, your articles are very interesting as always. keep us posting
Just want to say thanks for all the great info found on your blog, even helped me with my work recently
keep it up!
那我帮你测试一下喽,呵呵。