WordPress简单添加显示站点统计信息代码 WordPress 第1张

给你的WordPress站点添加统计代码,放在你想显示的主题文件中,把CSS代码放入你的主题样式文件里。

<ul class="codesign-footer-ul">
	<li class="codeisgn-footer"><h6 class="codesign-h6"><?php $count_posts = wp_count_posts(); echo $published_posts = $count_posts->publish; ?></h6>资源总数</li>
	<li class="codeisgn-footer weizhi1"><h6 class="codesign-h6"><?php echo get_week_post_count(); ?></h6>本周更新</li>
	<li class="codeisgn-footer weizhi1"><h6 class="codesign-h6"><?php echo WeeklyUpdate(); ?></h6>今日更新</li>
	<li class="codeisgn-footer weizhi1"><h6 class="codesign-h6"><?php $users = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->users"); echo $users; ?></h6>会员数量</li>
	<li class="codeisgn-footer weizhi1"><h6 class="codesign-h6"><?php $total_comments = get_comment_count(); echo $total_comments['approved'];?></h6>评论总数</li>
</ul>
/* 文字统计排版开始 */
.codesign-footer-ul{
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-flex-direction: row;
    -ms-flex-direction: row;
    flex-direction: row;
    padding-left: 0;
}
.codeisgn-footer {
    list-style: none;
    font-size: 13px;
}
.codesign-h6 {
    line-height: 0px !important;
    font-size: 20px !important;
    margin-right: 30px;
    margin-bottom: 10px !important;
    font-weight: 700 !important;
	color: #f84270;
}
.weizhi1 {
	margin-left: 30px;
}
/* 文字统计排版结束 */

WordPress站点信息统计代码文章数量页面数量教程

发表评论

后才能评论