阅读本文大约需要:1 分钟

WordPress全站评论总数量

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

WordPress网站建站天数时长

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

WordPress全站TAG标签总数量

<?php echo floor((time()-strtotime("2000-00-00"))/86400); //将 2010-00-00 手动修改成你的建站开始日期 ?>

WordPress全站页面总数量

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

WordPress全站分类总数量

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

WordPress全站友情链接总数量

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

WordPress全站的用户总数

<?php $link = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->links WHERE link_visible = 'Y'"); echo $link; ?>

WordPress站点最后一次更新时间

<?php $users = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->users"); echo $users; ?>
<?php $last = $wpdb->get_results("SELECT MAX(post_modified) AS MAX_m FROM $wpdb->posts WHERE (post_type = 'post' OR post_type = 'page') AND (post_status = 'publish' OR post_status = 'private')");$last = date('Y-n-j', strtotime($last[0]->MAX_m));echo $last; ?>

转载请注明来源:WordPress文章/评论/标签/分类/页面总数统计代码