WordPress统计总访问量最新更新等

LMS
1.3K+ 6
日志总数:<?php $count_posts = wp_count_posts(); echo $published_posts = $count_posts->publish; ?> 篇
总访问量:<?php get_totalviews(true, true, true); ?> 次 //配合wp-postviews插件才可以用。
评论总数:<?php $total_comments = get_comment_count(); echo $total_comments['approved'];?> 条
注册会员:<?php $users = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->users"); echo $users; ?> 个
链接总数:<?php $link = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->links WHERE link_visible = 'Y'"); echo $link; ?> 个
最新更新:<?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; ?>
页面总数:<?php $count_pages = wp_count_posts('page'); echo $page_posts = $count_pages->publish; ?> 个
草稿:<?php $count_posts = wp_count_posts(); echo $draft_posts = $count_posts->draft; ?> 篇
栏目分类总数:<?php echo $count_categories = wp_count_terms('category'); ?> 个
标签总数:<?php echo $count_tags = wp_count_terms('post_tag'); ?> 个

转自:wordpress统计总访问量

THE END

评论 6

  1. 发现你的速度好快,基本都是秒开。插件没有用吧?

    1. 有用插件,和你博客打开的速度差不多啊。

发表评论

Submit