echo "<ol id='the-comment-list' class='commentlist' $start>\n"; $i = 0; foreach ( $comments as $comment ) { get_comment( $comment ); // Cache it _wp_comment_list_item( $comment->comment_ID, ++$i ); } echo "</ol>\n\n"; if ( $extra_comments ) : ?> <div id="extra-comments" style="display:none"> <ul id="the-extra-comment-list" class="commentlist"> <?php foreach ( $extra_comments as $comment ) { get_comment( $comment ); // Cache it _wp_comment_list_item( $comment->comment_ID, ++$i ); } ?> </ul> </div> <?php endif; // $extra_comments ?> <div id="ajax-response"></div> <?php } else { //no comments to show ?> <p> <strong><?php _e('No comments found.') ?></strong></p>
break; case 'add-comment' : if ( !current_user_can( 'edit_post', $id ) ) die('-1'); $search = isset($_POST['s']) ? $_POST['s'] : false; $start = isset($_POST['page']) ? intval($_POST['page']) * 25 : 25; list($comments, $total) = _wp_get_comment_list( $search, $start, 1 ); if ( !$comments ) die('1'); $x = new WP_Ajax_Response(); foreach ( (array) $comments as $comment ) { get_comment( $comment ); ob_start(); _wp_comment_list_item( $comment->comment_ID ); $comment_list_item = ob_get_contents(); ob_end_clean(); $x->add( array( 'what' => 'comment', 'id' => $comment->comment_ID, 'data' => $comment_list_item ) ); } $x->send(); break; case 'add-meta' : if ( !current_user_can( 'edit_post', $id ) ) die('-1'); if ( $id < 0 ) { $now = current_time('timestamp', 1);