文章归档

WordPress 显示真实的访客评论数量

function no_admin_number($no='', $one='', $twomore='') {
global $wpdb, $tablecomments, $post;
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $post->ID AND comment_type = '' AND comment_approved = '1' AND comment_author != '博主姓名'");
$cnt = count($comments);
if (!$cnt)
echo $no;
elseif ($cnt == 1)
echo $one;
else
echo str_replace("%", $cnt, $twomore);
}
<?php no_admin_number('No Comment', '1 Comment', '% Comments');?>

via:http://ishawn.net/my-blog-related/display-the-real-comment-number-except-admin.html

无觅相关文章插件,快速提升流量