wordpress调用网站统计大全

  • 2016-4-29 08:41
  • PHP二次开发
  • 阅读(2606)
  • 评论(2
  • 来源:互联网
  • 摘要: 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、评论总数 ...
    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 floor((time()-strtotime("20018"))/86400); ?>

    5、标签总数:
    <?php echo $count_tags = wp_count_terms('post_tag'); ?>

    6、页面总数:
    <?php $count_pages = wp_count_posts('page'); echo $page_posts = $count_pages->publish; ?>

    7、分类总数:
    <?php echo $count_categories = wp_count_terms('category'); ?>

    8、链接总数:
    <?php $link = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->links WHERE link_visible = 'Y'"); echo $link; ?>

    9、用户总数:
    <?php $users = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->users"); echo $users; ?>

    10、最后更新:

    <?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技术交流QQ群:422137578

    除非注明,文章均为 PHP二次开发 原创,转载请注明本文地址:http://www.php2.cc/article-2205-1.html

    相关阅读

    发表评论

    最新评论

    引用 刘明野的博客   2016-9-3 19:58
    写的很好,感谢分享
    引用 做个安静的小女子   2016-4-30 16:10
    不错哦,挺有用处

    查看全部评论(2)

    用户名:  *

    邮 箱:  *

    网 址: 注意加上“http://”哦!