Physical Address

哈喽,小弟在广州,得闲饮茶!

博客统计代码

<div>
<h3>博客统计</h3>
<div>
<p> 日志总数:<?php $count_posts = wp_count_posts(); echo $published_posts = $count_posts->publish;?> 篇</p>
<p> 评论总数:<?php $comment = $wpdb->get_var(“SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = ‘1’ AND comment_type != ‘trackback’ AND comment_type != ‘pingback'”);echo $comment;?> 篇</p>
<p> 标签总数:<?php echo $count_tags = wp_count_terms(‘post_tag’); ?> 个</p>
<p> 建站日期:2010-10-28</p>
<p> 网站运行:<?php echo floor((time()-strtotime(“2010-10-28”))/86400); ?> 天</p>
<p> 最后更新:<?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; ?></p>
</div>
<div>
<b></b>
<b></b>
</div>
</div>
添加在  边栏模板 (sidebar.php)

的<div></div>
<!– end: widget –>
</div>

上面。

代码转自 HotNews主题QQ群48058847  的群共享。

7 评论

留下评论