我不知道插件,但你可以使用它:
作者。php您可以使用它来统计帖子:
<?php
global $wp_query;
$curauth = $wp_query->get_queried_object();
$post_count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = \'" . $curauth->ID . "\' AND post_type = \'post\' AND post_status = \'publish\'");
?>
<h2>Post Count: <?php echo $post_count; ?></h2>
在循环中,您可以使用此选项统计帖子和评论:
<?php
global $wpdb;
$user_id = $post->post_author; //change this if not in a std post loop
$where = \'WHERE comment_approved = 1 AND user_id = \' . $user_id ;
$comment_count = $wpdb->get_var(
"SELECT COUNT( * ) AS total
FROM {$wpdb->comments}
{$where}
");
$user = get_userdata($user_id);
$post_count = get_usernumposts($user->ID);
echo \'<p>User \' . $user->display_name . \' post count is \' . $post_count .\', comment count is \' . $comment_count . \'</p>\';
?>
对于所有作者:
<?php
global $wpdb;
$where = \'WHERE comment_approved = 1 AND user_id <> 0\';
$comment_counts = (array) $wpdb->get_results("
SELECT user_id, COUNT( * ) AS total
FROM {$wpdb->comments}
{$where}
GROUP BY user_id
", object);
foreach ( $comment_counts as $count ) {
$user = get_userdata($count->user_id);
$post_count = get_usernumposts($user->ID);
echo \'<p>User \' . $user->display_name . \' post count is \' . $post_count .\', comment count is \' . $count->total . \'</p>\';
}
?>