function latest_comments($count = 10) { global $wpdb; $sql = "SELECT DISTINCT ID, post_name, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_date_gmt, comment_approved, comment_type, comment_content AS com_excerpt \n\t\tFROM {$wpdb->comments} \n\t\tLEFT OUTER JOIN {$wpdb->posts} ON ({$wpdb->comments}.comment_post_ID = {$wpdb->posts}.ID) \n\t\tWHERE comment_approved = '1' AND comment_type = '' AND post_password = '' \n\t\tORDER BY comment_date_gmt DESC \n\t\tLIMIT {$count}"; $comments = $wpdb->get_results($sql); foreach ($comments as $comment) { $post['url'] = $comment->post_name; $post['title'] = $comment->post_title; custom_comments(get_comment($comment->comment_ID), false, false, $post); } }
_e('Make a trackback', 'inove'); echo '</a></span> '; } echo ' </div> <!-- comments START --> <ol id="thecomments" class="commentlist"> '; if ($comments && count($comments) - count($trackbacks) > 0) { if (function_exists('wp_list_comments')) { wp_list_comments('type=comment&callback=custom_comments'); } else { foreach ($comments as $comment) { if ($comment->comment_type != 'pingback' && $comment->comment_type != 'trackback') { custom_comments($comment, null, null); } } } } else { echo ' <li class="messagebox"> '; _e('No comments yet.', 'inove'); echo ' </li> '; } echo ' </ol> <!-- comments END --> '; if (get_option('page_comments')) {
function load_comment() { if ($_GET['action'] == 'load_comment' && $_GET['id'] != '') { $comment = get_comment($_GET['id']); if (!$comment) { fail(printf('Whoops! Can\'t find the comment with id %1$s', $_GET['id'])); } custom_comments($comment, null, null); die; } }