前言
今天分享的教程是WordPress子比主题美化教程:文章角标及封面图底部美化。简单的来说,就是在文章发布页面增加一个附加选项,可以通过这个附加选项达到我们想要的美化效果。
效果图
![图片[1]-子比主题美化 – 文章角标/封面图底部美化代码教程-AA源码网 | 源码收藏](https://images.aaym.net/2024/02/20240221153222714-image-950x187.png!/format/webp/lossless/true)
- 文章发布时可自行配置输入内容以及颜色,不填写内容则不显示。
![图片[2]-子比主题美化 – 文章角标/封面图底部美化代码教程-AA源码网 | 源码收藏](https://images.aaym.net/2024/02/20240221145530302-f4a0ea3c28d4e641ebce2fdbeba951e9-950x427.png!/format/webp/lossless/true)
代码教程
- 添加css代码至下方路径
Zibll主题设置>>全局&功能>>自定义代码>>自定义CSS样式
/*角标css*/.posts-item.card .item-thumbnail {background:#c4cffa26;width:100%;padding-bottom:var(--posts-card-scale);}a.item-category {position:absolute;left:10px;top:10px;padding:5px 6px;font-size:1rem;line-height:1;color:#fff;background:var(--theme-color);border-radius:6px;}a.item-category-app {position:absolute;height:24px;line-height:24px;width:100%;text-align:center;bottom:0;left:0;background:radial-gradient(circle,#3783ff,#3783ffbf);color:#fff;font-size:12px;border-radius:0 0 10px 10px;}a.item-category-app-b {position:absolute;height:24px;line-height:24px;width:100%;text-align:center;bottom:0;left:0;background:radial-gradient(circle,#ff5631,#ff5631ba);color:#fff;font-size:12px;border-radius:0 0 10px 10px;}a.item-category-app-c {position:absolute;height:24px;line-height:24px;width:100%;text-align:center;bottom:0;left:0;background:radial-gradient(circle,#464242,#464242ad);color:#fff;font-size:12px;border-radius:0 0 10px 10px;}span.bottom-l {overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.n-collect-item-bottom {position:absolute;bottom:0;left:0;width:100%;height:25px;background:var(--theme-color);border-radius:0 0 var(--main-radius);font-size:13px;color:#fff;text-shadow:0 2px 2px rgba(0,0,0,.16);display:flex;-webkit-box-align:center;align-items:center;-webkit-box-pack:justify;justify-content:space-between;padding:0 18px;z-index:5;justify-content:center;}.jiaobiao2 {position:absolute;top:10px;right:-50px;z-index:1;width:140px;height:20px;background:var(--theme-color);color:#fff;line-height:20px;transform:rotate(45deg);text-align:center;font-size:12px;left:auto;border-radius:0 50px 50px 0;}/*角标css*/ .posts-item.card .item-thumbnail { background:#c4cffa26; width:100%; padding-bottom:var(--posts-card-scale); } a.item-category { position:absolute; left:10px; top:10px; padding:5px 6px; font-size:1rem; line-height:1; color:#fff; background:var(--theme-color); border-radius:6px; } a.item-category-app { position:absolute; height:24px; line-height:24px; width:100%; text-align:center; bottom:0; left:0; background:radial-gradient(circle,#3783ff,#3783ffbf); color:#fff; font-size:12px; border-radius:0 0 10px 10px; } a.item-category-app-b { position:absolute; height:24px; line-height:24px; width:100%; text-align:center; bottom:0; left:0; background:radial-gradient(circle,#ff5631,#ff5631ba); color:#fff; font-size:12px; border-radius:0 0 10px 10px; } a.item-category-app-c { position:absolute; height:24px; line-height:24px; width:100%; text-align:center; bottom:0; left:0; background:radial-gradient(circle,#464242,#464242ad); color:#fff; font-size:12px; border-radius:0 0 10px 10px; } span.bottom-l { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; } .n-collect-item-bottom { position:absolute; bottom:0; left:0; width:100%; height:25px; background:var(--theme-color); border-radius:0 0 var(--main-radius); font-size:13px; color:#fff; text-shadow:0 2px 2px rgba(0,0,0,.16); display:flex; -webkit-box-align:center; align-items:center; -webkit-box-pack:justify; justify-content:space-between; padding:0 18px; z-index:5; justify-content:center; } .jiaobiao2 { position:absolute; top:10px; right:-50px; z-index:1; width:140px; height:20px; background:var(--theme-color); color:#fff; line-height:20px; transform:rotate(45deg); text-align:center; font-size:12px; left:auto; border-radius:0 50px 50px 0; }/*角标css*/ .posts-item.card .item-thumbnail { background:#c4cffa26; width:100%; padding-bottom:var(--posts-card-scale); } a.item-category { position:absolute; left:10px; top:10px; padding:5px 6px; font-size:1rem; line-height:1; color:#fff; background:var(--theme-color); border-radius:6px; } a.item-category-app { position:absolute; height:24px; line-height:24px; width:100%; text-align:center; bottom:0; left:0; background:radial-gradient(circle,#3783ff,#3783ffbf); color:#fff; font-size:12px; border-radius:0 0 10px 10px; } a.item-category-app-b { position:absolute; height:24px; line-height:24px; width:100%; text-align:center; bottom:0; left:0; background:radial-gradient(circle,#ff5631,#ff5631ba); color:#fff; font-size:12px; border-radius:0 0 10px 10px; } a.item-category-app-c { position:absolute; height:24px; line-height:24px; width:100%; text-align:center; bottom:0; left:0; background:radial-gradient(circle,#464242,#464242ad); color:#fff; font-size:12px; border-radius:0 0 10px 10px; } span.bottom-l { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; } .n-collect-item-bottom { position:absolute; bottom:0; left:0; width:100%; height:25px; background:var(--theme-color); border-radius:0 0 var(--main-radius); font-size:13px; color:#fff; text-shadow:0 2px 2px rgba(0,0,0,.16); display:flex; -webkit-box-align:center; align-items:center; -webkit-box-pack:justify; justify-content:space-between; padding:0 18px; z-index:5; justify-content:center; } .jiaobiao2 { position:absolute; top:10px; right:-50px; z-index:1; width:140px; height:20px; background:var(--theme-color); color:#fff; line-height:20px; transform:rotate(45deg); text-align:center; font-size:12px; left:auto; border-radius:0 50px 50px 0; }
- 将下面代码添加进子比主题下的
func.php
文件内。
若没有可自行新建func.php
文件,记得复制<?php
去掉前面两竖线
- 打开子比主题文件路径:
/inc/functions/zib-post-list.php
,搜索关键词置顶
找到下方代码位置
if (is_sticky()) {$sticky = '<badge class="img-badge left jb-red">置顶</badge>';} else {$sticky = '';}if (is_sticky()) { $sticky = '<badge class="img-badge left jb-red">置顶</badge>'; } else { $sticky = ''; }if (is_sticky()) { $sticky = '<badge class="img-badge left jb-red">置顶</badge>'; } else { $sticky = ''; }
最后,在上述代码最后的}
代码添加下面的代码保存即可。(如图所示位置)
![图片[3]-子比主题美化 – 文章角标/封面图底部美化代码教程-AA源码网 | 源码收藏](https://images.aaym.net/2024/02/20240221190702915-image-950x540.png!/format/webp/lossless/true)
温馨提示
- 此代码教程涉及修改主题源文件,建议提前备份源文件再进行操作,避免出现不可逆的损失。
- 按上述流程操作完成后,建议清理cdn/浏览器缓存。(未开启缓存忽略即可)
本文结束END

© 版权声明
THE END
- 最新
- 最热
只看作者