以下代码完成的功用是在网站前端界面,挪用整站的文章总数、分类总数、批评总数以及页面总数目显现在指定位置,操纵简朴,直接把代码复制运用即可,固然显现款式须要自行编写。
统计代码:
12345678910 | <?php if ($this->options->sidebarBlock && in_array('showSiteStatistics', $this->options->sidebarBlock)): ?><section class="widget"><h3><?php _e('数据统计'); ?></h3><ul> <?php Typecho_Widget::widget('Widget_Stat')->to($stat); ?><li><?php _e('文章数目:'); ?><?php $stat->publishedPostsNum() ?></li><li><?php _e('分类数目:'); ?><?php $stat->categoriesNum() ?></li><li><?php _e('批评数目:'); ?><?php $stat->publishedCommentsNum() ?></li><li><?php _e('页面数目:'); ?><?php echo $stat->publishedPagesNum + $stat->publishedPostsNum; ?></li></section> |
把上面的代码添加到当前运用主题的模板文件即可。
文章由 博客吧 整顿宣布

评论列表