Support » Themes and Templates » Replying to inline comments makes page reload

  • Resolved Psylicium


    Hi. I’m developing a website for a friend, but I am having a problem with replying to comments. On my personal site, whenever I reply to a comment, the page does not reload, and the textarea reply box is displayed below the comment i am replying to (like it should). However, on this new site, the page reloads, and the textarea is still at the bottom of the comment list. I have re-used most of the code from my personal site, but just can’t figure out if I have missed something…

    I am using a custom callback on both sites, defined in functions.php:

    function custom_comments($comment, $args, $depth) {
    global $counter; // Make counter variable global so we can use it inside this function.
    $GLOBALS['comment'] = $comment;
    <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
    <?php echo get_avatar($comment,$size='48',$default='<path_to_url>' ); ?>
    <div class="comment_body">
    <div class="author"><?php printf(__('%s'), get_comment_author_link()) ?></div>
    <div class="commentmeta"><?php printf(__('%1$s kl. %2$s'), get_comment_date(),  get_comment_time()) ?><?php edit_comment_link(__('Edit'),'  ','') ?></div>
    <?php comment_text() ?>
    <div class="reply"><span><?php comment_reply_link(array_merge( $args, array('reply_text' => 'Svar', 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?></span></div>
    <?php if ($comment->comment_approved == '0') : ?>
    <em><?php _e('Your comment is awaiting moderation.') ?></em>
    <?php endif; ?>
    <?php } ?>

    My comments.php looks like this:

    <ol class="commentlist">
    <?php wp_list_comments('callback=custom_comments'); ?>

    – and I have also included the following in header.php, just above wp_head();:

    if ( is_singular() && get_option( 'thread_comments' ) )
    wp_enqueue_script( 'comment-reply' );

    Anyone knows what could be wrong? 🙂

Viewing 1 replies (of 1 total)
  • Oh, I think I figured it out. Turns out that i was missing a “parent” tag in the <li> class, and that my <div class="reply"> was also a bit messed. It works now 🙂

Viewing 1 replies (of 1 total)
  • The topic ‘Replying to inline comments makes page reload’ is closed to new replies.