原作者李哒胖子https://ourule.com/332.html,极主题作过校正。
本站的角标是偷懒做法,判断文章属于哪个分类,显示哪个分类的角标,不需要在文章编辑时勾先显示角标。不喜则用网上b2标注角标的教程到处都有的。
效果图
教程开始
文章meta选择
只勾选作者,分类,摘要。
列表样式
选网格模式(第一个)
b2child目录下的文件上传至子主题b2child下
functions里面插入子主题functions.php
需要修改functions里面的数字id和分类名称
function代码
/*文章角标设置开始*/
//注意:in_category后面的id就是你的分类id,可以更改成自己,按样子照写就行
function tianyishangke_post_newicon($post){
if ( in_category( array( '3', '5', ) )){
$wiui_new_icon = '<div class="tipss jiaobiao_color2">支持M1/M2</div>';
}
elseif ( in_category(17)) {
$wiui_new_icon = '<div class="tipss jiaobiao_color2">B2美化</div>';
}
elseif (in_category(6)) {
$wiui_new_icon = '<div class="tipss jiaobiao_color2">教程必看</div>';
}
else{
$wiui_new_icon = '';
}
return $wiui_new_icon;
}
/*文章角标设置结束*/
css代码
/*优设文章列表角标开始*/
.tipss {
position: absolute;
top: 0px;
left: 0px;
/* -webkit-transform: rotate(45deg); */
z-index: 1;
/* width: 40px; */
padding: 0px 5px;
height: 20px;
color: #fff;
line-height: 20px;
text-align: center;
font-size: 12px;
font-style: normal;
}
.jiaobiao_color1 {
color: #fff;
background-color: #d80202;
}
.jiaobiao_color2 {
color: #fff;
background-color: #545454;
}
/*优设文章列表角标结束*/
/*李哒胖子文章列表页美化开始*/
.jitheme_cat_jb {
display: flex;
line-height: 20px;
margin-top: -20px;
height: 20px;
position: relative;
z-index: 2;
}
.post-1 .tipss_mate:first-child, .post-2 .tipss_mate:first-child, .post-7 .tipss_mate:first-child, .post-4 .tipss_mate:first-child {
border-bottom-left-radius: 4px;
}
.post-1 .tipss_mate, .meta-post-type, .post-2 .tipss_mate, .post-8 .tipss_mate {
font-size: 12px;
display: flex;
width: fit-content;
align-items: center;
padding: 0px 5px 0px 5px;
}
.tipss_mate {
background-color: rgba(0,0,0,0.3);
color: #fff;
}
.post-thumb {
background-color: unset!important;
}
.col-3{
flex: 0 0 auto;
width: 25% !important;
}
.col-3 .widget-area{
width: calc(100% - 16px);
min-width: auto !important;
}
.col-3 .widget-title{
font-size:23px;
font-family: "webfont";
border-bottom: 1px solid #eee;
padding: 20px 0 20px 42px;
}
.col-3 .b2-widget-hot li.widget-post-none{
height: 72px;
}
.col-3 .b2-widget-post-order span{
font-size: 28px;
height: 36px;
line-height:36px;
}
.col-3 .widget ul li h2{
font-size: 14px;
line-height: 24px;
margin-bottom: 0;
}
.newstyle .item-in{
padding:24px 18px 18px;
}
.newstyle .item-in .post-info h2{
font-size: 16px;
margin: 10px 0 10px;
line-height: 25px;
color: #333;
}
@media screen and (max-width: 768px){
.newstyle .item-in{
padding:5px 5px 5px;
}
.newstyle .item-in .post-info h2{
font-size: 13px!important;
margin: 5px 0 5px!important;
line-height: 20px!important;
color: #333;
}
.newstyle .post-info .post-excerpt p {
-webkit-line-clamp: 2;
overflow: hidden;
font-size: 11px!important;
line-height: 12px!important;
display: -webkit-box;
-webkit-box-orient: vertical;
word-break: break-all;
}
.newstyle .post-info .post-excerpt{
padding:5px 5px!important;
}
}
.newstyle .post-thumb{
border-radius: 4px;
}
.newstyle .post-module-thumb a.thumb-link{
overflow: hidden;
display: block;
}
.newstyle .post-module-thumb img{
-webkit-transition: all .3s;
transition: all .3s;
}
.newstyle .item-in:hover .post-module-thumb img{
transform: scale(1.2) rotate(5deg);
}
.newstyle .post-info .post-excerpt{
margin:0 0 5px;
background: #fafafa;
padding: 12px 16px;
font-size: 14px;
}
.newstyle .post-info .post-excerpt p{
-webkit-line-clamp: 2;
overflow: hidden;
font-size:13px;
line-height: 25px;
display: -webkit-box;
-webkit-box-orient: vertical;
word-break: break-all;
}
.newstyle .list-footer {
border:none;
}
.newstyle .list-footer .post-list-meta-avatar img{
width: 24px;
height: 24px;
margin-right: 8px;
}
.newstyle .list-footer span{
overflow: visible;
font-size: 14px;
}
.newstyle .post-list-meta-box{
position:absolute;
right: 18px;
bottom: 21px;
}
.author-page .list-footer,.author-page .newstyle .post-list-meta-box{
display:none;
}
.newstyle .post-list-meta-box a{
font-size: 14px;
color: #b5b5b5 !important;
padding-left:24px;
}
.newstyle .post-list-meta-box a:hover,
.newstyle .list-footer a:hover{
color:#0066ff !important;
}
.newstyle .post-list-meta-box a:before{
content: '#';
width: 18px;
height: 18px;
color: rgba(0, 102, 255,1);
text-align: center;
background: rgba(0, 102, 255,0.2);
border-radius: 50%;
display: block;
position: absolute;
left: 0;
}
@media screen and (max-width: 768px) {
.newstyle .post-info .post-excerpt{
margin-bottom: 1px;
}
.col-3,
ul.b2_gap>li.newstyle{
width: 50% !important;
}
.newstyle .post-list-meta-avatar img{
display: block;
}
.newstyle .list-footer{
display:none;
}
.newstyle .post-list-meta-box{
bottom: 10px;
}
.post-list-cat{
display:none;
}
}
/*李哒胖子文章列表页美化结束*/
素材卡片上传至主题目录覆盖
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容