My suggestion would be twofold:
- Ensure you are properly enqueueing the
comment-reply
script - Replace your hard-coded comment list with
wp_list_comments()
Enqueueing comment-reply
I would recommend hooking into comment_form_before()
:
function wpse71451_enqueue_comment_reply() {
if ( get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
// Hook into comment_form_before
add_action( 'comment_form_before', 'wpse71451_enqueue_comment_reply' );
Outputting the comment list
Using wp_list_comments()
with default output in your code:
<?php if($comments) : ?>
<ol class="commentlist">
<?php wp_list_comments(); ?>
</ol>
<?php else : ?>
<p>No comments yet</p>
<?php endif; ?>
If you need specific markup for the comment list, you can pass a callback as a parameter to wp_list_comments()
. But I would strongly recommend making sure everything works with the default output first, and then try to customize.
You can use your own custom markup in a callback, but you’ll need to be sure to define the variables you’re using, such as $depth
and $args
. If you can provide specific markup questions, I can help construct the callback.