详情
评论
问答

子比主题-文章缩略图角标

文章最后更新时间:2025-06-09 10:04:27

效果图:

图片[1]--阿七|阿七源码|建站源码|小程序源码|模板|下载子比主题-文章缩略图角标--阿七|阿七源码|建站源码|小程序源码|模板|下载阿七源码

教程开始:

1.CSS代码样式 在后台主题设置[自定义CSS样式]添加下面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;
}

第二步:在“../zibll/functions.php”子比主题的目录下“functions.php”文件合适位置添加下面代码:

CSF::createMetabox('Mario', array(
    'title'     => '附加选项',
    'post_type' => array('post', 'plate', 'forum_post'),
    'context'   => 'advanced',
    'data_type' => 'unserialize',
));
CSF::createSection('Mario', array(
    'fields' => array(
        array(
            'title'   => __('开启文章角标'),
            'id'      => 'Mario_edit',
            'type'    => 'switcher',
            'label'   => '角标',
            'desc'   => '填哪个显示哪个,不想要的留空就行',
            'default' => false
        ),
        array(
            'dependency' => array('Mario_edit', '!=', ''),
            'title'   => __('左上角标内容'),
            'id'      => 'right_text',
            'type'    => 'text',
            'default' => '支持M1/M2',
        ),
        array(
            'dependency' => array('Mario_edit', '!=', ''),
            'title'   => __('背景颜色'),
            'id'      => 'right_color',
            'type'    => 'color',
            'default' => '#121212',
            'class'    =>'compact',
        ),
        array(
            'dependency' => array('Mario_edit', '!=', ''),
            'title'   => __('右上角标内容'),
            'id'      => 'left_text',
            'type'    => 'text',
            'default' => '实测',
        ),
        array(
            'dependency' => array('Mario_edit', '!=', ''),
            'title'   => __('背景颜色'),
            'id'      => 'left_color',
            'type'    => 'color',
            'default' => '#121212',
            'class'    =>'compact',
        ),
        array(
            'dependency' => array('Mario_edit', '!=', ''),
            'title'   => __('封面底部内容'),
            'id'      => 'bottom_text',
            'type'    => 'text',
            'default' => '支持Intel&M1&M2运行',
        ),
        array(
            'dependency' => array('Mario_edit', '!=', ''),
            'title'   => __('背景颜色'),
            'id'      => 'bottom_color',
            'type'    => 'color',
            'default' => '#121212',
            'class'    =>'compact',
        ),
    ),
));

第三步:在“../zibll/inc/functions/zib-posts-list.php”子比主题的template目录下“zib-posts-list.php”文件中搜索置顶:

if (zib_is_sticky()) {
        $sticky = '<badge class="img-badge left jb-red">置顶</badge>';
    } else {
        $sticky = '';
    }

下面添加代码:

 

子比主题-文章缩略图角标--阿七|阿七源码|建站源码|小程序源码|模板|下载阿七源码
子比主题-文章缩略图角标
此内容为付费阅读,请付费后查看
200
限时特惠
立即购买
您当前未登录!建议登陆后购买,可保存购买订单
付费阅读
© 版权声明
THE END
喜欢就支持一下吧
点赞11 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片快捷回复

    暂无评论内容