Don’t link the script file directly. Enqueue it instead, e.g. in functions.php
:
function mytheme_enqueue_comment_reply() {
// on single blog post pages with comments open and threaded comments
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
// enqueue the javascript that performs in-link comment reply fanciness
wp_enqueue_script( 'comment-reply' );
}
}
// Hook into wp_enqueue_scripts
add_action( 'wp_enqueue_scripts', 'mytheme_enqueue_comment_reply' );
You can also do this, in the document head, prior to the wp_head()
call:
<?php
// on single blog post pages with comments open and threaded comments
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
// enqueue the javascript that performs in-link comment reply fanciness
wp_enqueue_script( 'comment-reply' );
}
?>
EDIT:
Hooking into wp_head
, rather than e.g. wp_print_scripts
, is important. The wp_print_scripts
does not work in the same way that wp_print_styles
does, to output stylesheet links.
So: if you’re using wp_print_scripts
, change the hook to wp_head
.
EDIT 2:
Based on your pastebin-linked code, have you tried the following, to rule out potential issues?
- Remove callback function from
wp_comment_list()
- Move
wp_comment_list()
call to beforecomment_form()
call - Remove the argument array from
comment_form()
I don’t know that any of those will solve your problem, but they may help us track down its origin.