以下为wordpress博客统计函数大全,博主可以根据需要选用博客统计函数

<strong>成立时间:</strong>

<? php echo floor((time()-strtotime(“2008-8-1″))/86400); ?>

<strong>分类总数:</strong>

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

<strong>页面总数:</strong>

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

<strong>日志总数:</strong>

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

<strong>草稿数目:</strong>

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

<strong>标签总数:</strong>

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

<strong>评论总数:</strong>

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

<strong>链接总数:</strong>

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

<strong>最后更新:</strong>

<? 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; ?>

<strong>用户总数:</strong>

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



© 活着的博客 - 李权辉的个人博客:人,终究是生活在现实之中,是为了活着而生活.