wordpress给网站侧边栏添加网站信息统计

图片[1] | wordpress给网站侧边栏添加网站信息统计 | 无聊笔记

教程:

  1. 首先第一步在你的主题目录下面下载我准备好的 widget-websitestat.php 文件,文件我放在文章结尾
  2. 在主题目录下themes/zibll/functions.php文件中,添加下面的函数代码即可。随便你添加在多少行
//添加站点统计小工具-56.ink
include("widget-websitestat.php");

3.在网站后台---》zibill 主题设置---》自定义代码---》自定义 CSS 样式,添加下面的 CSS 代码,

  • 主题没有自定义 CSS 样式的,在主题目录下 style.css 添加也都可以。
/*网站侧栏添加统计信息小模块CSS代码  by 无聊笔记*/
.widget_Websitestat h3{font-weight:700;}.widgest-boys{overflow:hidden;}.widgest-boys .widgest-bg{margin: 4px; background-size: cover; background-repeat: no-repeat; background-position: center center; cursor: pointer; border-radius: 8px;}.widgest-boys .widgest-main{align-items: center; place-content: flex-start space-around; display: flex;}.widgest-boys .widgest-meat{display: block; margin-block-start: 1em; margin-block-end: 1em; margin-inline-start: 0px; margin-inline-end: 0px; color: rgb(255, 255, 255); font-weight: 700 !important; line-height: 1.5 !important;}.widgest-bg:not(article){transition: all 0.3s;}.widgest-bg:not(article):hover{transform: translateX(-10px);}
/*图片路径设置*/
.widgest-bg1{background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)),url(https://pic.imgdb.cn/item/63be5f7ebe43e0d30e8c250c.jpg);}
.widgest-bg2{background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)),url(https://pic.imgdb.cn/item/63be5f7ebe43e0d30e8c250c.jpg);}
.widgest-bg3{background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)),url(https://pic.imgdb.cn/item/63be5f7ebe43e0d30e8c250c.jpg);}
.widgest-bg4{background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)),url(https://pic.imgdb.cn/item/63be5f7ebe43e0d30e8c250c.jpg);}
.widgest-bg5{background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)),url(https://pic.imgdb.cn/item/63be5f7ebe43e0d30e8c250c.jpg);}
.widgest-bg6{background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)),url(https://pic.imgdb.cn/item/63be5f7ebe43e0d30e8c250c.jpg);}
.widgest-bg7{background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)),url(https://pic.imgdb.cn/item/63be5f7ebe43e0d30e8c250c.jpg);}
.widgest-bg8{background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)),url(https://pic.imgdb.cn/item/63be5f7ebe43e0d30e8c250c.jpg);}
.widgest-bg9{background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)),url(https://pic.imgdb.cn/item/63be5f7ebe43e0d30e8c250c.jpg);}
.widgest-bg10{background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)),url(https://pic.imgdb.cn/item/63be5f7ebe43e0d30e8c250c.jpg);}
.widgest-bg11{background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)),url(https://pic.imgdb.cn/item/63be5f7ebe43e0d30e8c250c.jpg);}
/*网站信息统计小模块 by 无聊笔记*/

CSS 代码中是有的 11 张图片是需要单独设置的,当然嫌麻烦的也可以引用我的,我把图片上传永久地址了

不想用我的图片你自己用一张图片剪切成 11 份,然后按顺序添加进去,css 中”widgest-bg1-widgest-bg11″都是按顺序好的,在 url(图片链接路径)里面加就行

推荐一个在线图片切割工具:https://www.qtool.net/piccutting

4.最后一步,在网站后台—》外观—》小工具—》午夜网站统计,添加首页到侧边栏即可完成。

图片[2] | wordpress给网站侧边栏添加网站信息统计 | 无聊笔记

widget-websitestat.php文件下载:

© 版权声明
THE END
喜欢就支持一下吧
点赞15 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容