Support » Fixing WordPress » 1st AJAX Comments appear below form

  • Resolved Sphagnum


    I’ve installed AJAX commenting on a new theme I’m tweaking for my blog: Bog 2.0

    I ripped the AJAX commenting code from the K2 theme:

    Here is the problem. When I post a comment, if it is the first comment, it says “Loading comment” where I would expect the first comment to appear, but then that disappears and the comment appears way down below the comment form. If there is already a comment posted, then t he code works fine. It’s only when I’m puting up the first comment. Problem is, I’m not very up on javascript. I THINK the problem lies in one of these two bits of code in the comments-ajax.php file that I got from the K2 theme:

    $post->comment_status = $wpdb->get_var("SELECT comment_status FROM {$wpdb->posts} WHERE ID = {$comment_post_ID}");

    $comments = array($comment);
    include(TEMPLATEPATH . '/comments.php');
    $commentout = ob_get_clean();
    preg_match('#<li(.*?)>(.*)#ims', $commentout, $matches);
    echo "<li style=\"display:none\"".$matches[1].">".$matches[2]."";


    can someone help me decode this? If I’m correct in these two lines beign the problem, where is it sending the comment to appear? Is it sending it to a div id perhaps that I need to change?

    If this is way off, I can provide other code or copy the entire comments file for further inspection.

    I really appreciate the help in advance!

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘1st AJAX Comments appear below form’ is closed to new replies.