怎么把WordPress的日志总数、草稿总数、评论总数、标签总数、页面总数、分类总数、链接总数、用户总数的统计结果都调用出来。

1、日志总数:

<?php $count_posts = wp_count_posts(); echo $published_posts = $count_posts->publish;?>

2、草稿总数:

<?php $count_posts = wp_count_posts(); echo $draft_posts = $count_posts->draft; ?>

3、评论总数:

<?php echo $wpdb->get_var(“SELECT COUNT(*) FROM $wpdb->comments”);?>

4、标签总数:

<?php echo $count_tags = wp_count_terms(‘post_tag’); ?>

5、页面总数:

<?php $count_pages = wp_count_posts(‘page’); echo $page_posts = $count_pages->publish; ?>

6、分类总数:

<?php echo $count_categories = wp_count_terms(‘category’); ?>

7、链接总数:

<?php $link = $wpdb->get_var(“SELECT COUNT(*) FROM $wpdb->links WHERE link_visible = ‘Y’”); echo $link; ?>

8、用户总数:

<?php $users = $wpdb->get_var(“SELECT COUNT(ID) FROM $wpdb->users”); echo $users; ?>