get_results("SELECT * FROM $wpdb->comments WHERE user_id !=1 and comment_approved = '1' and comment_type not in ('pingback','trackback') ORDER BY comment_date_gmt DESC LIMIT $number");
$output .= $before_widget;
if ($title)
$output .= $before_title . $title . $after_title;
$output .= '
';
if ($comments) {
// Prime cache for associated posts. (Prime post term cache if we need it for permalinks.)
$post_ids = array_unique(wp_list_pluck($comments, 'comment_post_ID'));
_prime_post_caches($post_ids, strpos(get_option('permalink_structure'), '%category%'), false);
foreach ((array) $comments as $comment) {
if ($comment->comment_author_email != $my_email) {
//头像
$avatar = get_avatar($comment, 50);
//作者名称
$author = get_comment_author();
//评论内容
$content = apply_filters('get_comment_text', $comment->comment_content);
$content = mb_strimwidth(strip_tags($content), 0, '65', '...', 'UTF-8');
$content = convert_smilies($content);
//评论的文章
$post = '' . $avatar . $author .''.timeago( $comment->comment_date_gmt ).': ' . $content . '';
//这里就是输出的html,可以根据需要自行修改
$output .= $post;
}
}
}
$output .= '
近期评论
get_results("SELECT * FROM $wpdb->comments WHERE user_id !=1 and comment_approved = '1' and comment_type not in ('pingback','trackback') ORDER BY comment_date_gmt DESC LIMIT $number"); $output .= $before_widget; if ($title) $output .= $before_title . $title . $after_title; $output .= '' . $content . ''; //这里就是输出的html,可以根据需要自行修改 $output .= $post; } } } $output .= '