function cupid_ajaxComment($comment_ID, $comment_status) { // If it's an AJAX-submitted comment if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { // Get the comment data $comment = get_comment($comment_ID); // Allow the email to the author to be sent wp_notify_postauthor($comment_ID); // Get the comment HTML from my custom comment HTML function $comments = get_comments(array('post_id' => $comment->comment_post_ID)); ob_start(); $number = get_comments_number($comment->comment_post_ID); ?> <h4 class="comments-title"><?php _e("Comments", 'cupid'); ?> (<?php echo esc_html($number); ?> )</h4> <ul class="comment-list"> <?php wp_list_comments(array('style' => 'li', 'type' => 'comment', 'callback' => 'cupid_get_list_comments', 'avatar_size' => 82), $comments); ?> </ul> <?php cupid_comment_form($comment->comment_post_ID); ?> <?php $commentContent = ob_get_clean(); // Kill the script, returning the comment HTML die($commentContent); } }
<nav class="comment-navigation clearfix pull-right" role="navigation"> <?php paginate_comments_links($paginate_comments_args); ?> </nav> <div class="clearfix"></div> <?php } ?> <?php } ?> </div> </div> <?php if (comments_open()) { ?> <div class="col-md-12"> <div class="entry-comments-form"> <?php cupid_comment_form(); ?> </div> </div> <?php } ?> </div> <?php }