在SQL查询语句里增加 AND user_id !=1 ,这个ID是管理员的,可以在这里查看。 //最新评论、留言 function recent_comment( $comment_post_ID=0, $get_total=5, $show_author_url=1, $before='<li>', $after='</li>') { global $wpdb; $is_gb =($comment_post_ID == "0") ? " != 'guestbook' " : " = 'guestbook' "; $request="SELECT ID, post_name, comment_ID, comment_content, comment_author_email, comment_author, comment_author_url, comment_date, post_title FROM $wpdb->comments "; $request .= " LEFT JOIN $wpdb->posts ON $wpdb->posts.ID=$wpdb->comments.comment_post_ID "; $request .= " WHERE post_status IN ('publish','static') AND comment_approved='1' AND $wpdb->posts.post_name ".$is_gb." AND user_id !=1 ORDER BY comment_ID DESC LIMIT $get_total"; $comments=$wpdb->get_results($request); if ($comments) { foreach ($comments as $comment) { $email=$comment->comment_author_email; $grav_url="http://www.gravatar.com/avatar/".md5($email)."?s=32"; $comment_author=stripslashes(strip_tags($comment->comment_author)); $comment_content=utf8Substr(stripslashes(strip_tags($comment->comment_content)),0,150); if ($show_author_url == 1 && strlen($comment->comment_author_url) > 12) $comment_author='<a target="_blank" title="访问 '.$comment_author. '的网站" href="' . $comment->comment_author_url . '">' . $comment_author . '</a>'; $post_title=stripslashes($comment->post_title); $comment_date=date("y-m-d H:i",strtotime($comment->comment_date)); $permalink=get_permalink($comment->ID)."#comment-".$comment->comment_ID; $output=$before."\n"; $output .= '<span class="avatar"><img src="'.$grav_url.'" alt="" /></span>'."\n"; $output .= '<span class="fn">'.$comment_author.'</span>'."\n"; $output .= '<span class="date">'.$comment_date.'</span>'."\n"; $output .= '<span class="txt"><a href="'.$permalink.'" title="'.$post_title.' » '.$comment_content.'">'.$comment_content.'</a></span>'."\n"; $output .= $after."\n"; echo $output."\n"; } } } |