Wordpress / Wordpress教程

WordPress文章/评论/标签/分类/页面总数统计代码

TSY · 6月17日 · 2020年本文共950个字 · 预计阅读4分钟367次已读

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全站页面总数量

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

WordPress全站分类总数量

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

W9rQCxMP4aMR2A3ZH68MP4I5o1coJzqMZordPressesfrdgrsGSSDXCSFD9rQCxMP4aMR2A3全站友情链esfrdgrsGSSDXCSFD9rQCxMP4aMR2A3接总数量

<?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站点最后一次esfrdgrsGSSDXCSFD9rQCxMP4aMR2A3更新时间

<?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; ?>
0 条回应