教程解读:
一个简单的功能,美化博客,功能自适应,图标自己修改,文字自己修改,别的主题自己测试。
美化代码如下:
<div class="table-r">
<table width="100%">
<tbody>
<tr>
<td style="text-align:center;" width="50%"><i class="zm zm-wenzhang" aria-hidden="true"></i>  资源总数:</td>
<td style="text-align:center;" width="50%"><?php $count_posts = wp_count_posts(); echo $published_posts = $count_posts->publish;?> 篇</td>
</tr>
<tr>
<td style="text-align:center;" width="50%"><i class="zm zm-liuyan3" aria-hidden="true"></i>  留言数量:</td>
<td style="text-align:center;" width="50%"><?php global $wpdb; echo $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments");?> 条</td>
</tr>
<tr>
<td style="text-align:center;" width="50%"><i class='zm zm-biaoqian'></i>  标签总数:</td>
<td style="text-align:center;" width="50%"><?php echo $count_tags = wp_count_terms('post_tag'); ?> 个</td>
</tr>
<tr>
<td style="text-align:center;" width="50%"><i class="zm zm-youlian" aria-hidden="true"></i>  友链链接:</td>
<td style="text-align:center;"width="50%"><?php global $wpdb; echo $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->links WHERE link_visible = 'Y'"); ?> 个</td><tr>
<td style="text-align:center;" width="50%"><i class="zm zm-anquanyunhang" aria-hidden="true"></i>
安全运行:</td>
<td style="text-align:center;" width="50%"><?php echo floor((time()-strtotime("2017-12-14"))/86400); ?> 天</td>
</tr><tr>
<td style="text-align:center;" width="50%"><i class="zm zm-liulan" aria-hidden="true"></i>  浏览总量:</td>
<td style="text-align:center;" width="50%"><?php echo all_view(); ?> 次</td>
</tr><tr>
<td style="text-align:center;" width="50%"><i class="zm zm-zuihougengxinshijian" aria-hidden="true"></i>  最后更新:</td>
<td style="text-align:center;" width="50%"><?php global $wpdb; $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; ?></td>
</tr>
</tr>
</tbody>
</table>
</div>
教程效果
转载请注明:汇站网 » 主题网站统计美化代码