首页>文档>源码技巧>Wordpress>B2美化>7b2主题首页栏目文章标题美化

此组别内的文章

需要支持?

如果通过文档没办法解决您的问题,请提交工单获取我们的支持!

7b2主题首页栏目文章标题美化

WordPress系统7b2主题首页栏目文章标题美化。这篇文章介绍了如何美化7b2首页文章标题,包括在相关代码中添加模块标题框、修改CSS样式以设置背景和边距,以及在子主题的functions.php中加载这些文件,以实现更美观的标题效果。

7b2主题首页栏目文章标题美化插图
WordPress系统7b2主题首页栏目文章标题美化。

首先找到b2主题或者子主题下面的/themes/b2child/Modules/Templates/Modules/posts.php

搜索代码modules-title-box然后对应下面的代码添加

 
// $desc = in_array('desc',$post_meta);
$randomNumber = rand(1, 7);
//$desc = in_array('desc',$post_meta);
$html .= '<div class="modules-title-box" id="biaotibg'.$randomNumber.'">';

其次/b2child/Modules/Templates/Modules/Products.php

搜索代码modules-title-box然后对应下面的代码添加

 $randomNumber = rand(1, 7);
$html .= '<div class="shop-box-title"><div class="modules-title-box" id="biaotibg'.$randomNumber.'">';

找到b2主题或者子主题下面的/Modules/Templates/Header.php<style>.header-banner{之间添加下面代码

#biaotibg1 {
 
height: 39px;
background: url(https://oss.dzcrv.com/1/goods-title.png) no-repeat;
background-position: 0 0;
 
position: relative;
margin-left: -10px;
margin-right: 20px;
}
#biaotibg2 {
 
height: 39px;
background: url(https://oss.dzcrv.com/1/goods-title.png) no-repeat;
background-position: 0 -55px;
 
position: relative;
margin-left: -10px;
margin-right: 20px;
}
#biaotibg3 {
 
height: 39px;
background: url(https://oss.dzcrv.com/1/goods-title.png) no-repeat;
background-position: 0 -385px;
 
position: relative;
margin-left: -10px;
margin-right: 20px;
}
#biaotibg4 {
 
height: 39px;
background: url(https://oss.dzcrv.com/1/goods-title.png) no-repeat;
background-position: 0 -165px;
 
position: relative;
margin-left: -10px;
margin-right: 20px;
}
#biaotibg5 {
 
height: 39px;
background: url(https://oss.dzcrv.com/1/goods-title.png) no-repeat;
background-position: 0 -220px;
 
position: relative;
margin-left: -10px;
margin-right: 20px;
}
#biaotibg6 {
 
height: 39px;
background: url(https://oss.dzcrv.com/1/goods-title.png) no-repeat;
background-position: 0 -275px;
 
position: relative;
margin-left: -10px;
margin-right: 20px;
}
#biaotibg7 {
 
height: 39px;
background: url(https://oss.dzcrv.com/1/goods-title.png) no-repeat;
background-position: 0 -330px;
 
position: relative;
margin-left: -10px;
margin-right: 20px;
}
.modules-title-box .module-title {
padding-left: 45px;
padding-top: 8px;
}

在子主题下functions.php加载刚刚修改的这些文件,如果子主题没有这三个文件,对应 从b2里面复制到子主题下面

require_once get_theme_file_path('/Modules/Templates/Header.php');
require_once get_stylesheet_directory() . '/Modules/Templates/Modules/Posts.php';
require_once get_stylesheet_directory() . '/Modules/Templates/Modules/Products.php';
0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索