A-A+
WordPress修改标签为随机颜色教程
教程开始
首先我们需要确定的是你的主题全局调用的.CSS文件是什么,dux的css为main.css其他主题一般也都是这个,还有的是style.css一般都在主题的css文件夹里
在全局调用的css文件里添加以下代码
/**biaoji**/
.article-categories {
margin-bottom: 10px
}
.article-categories a {
padding: 4px 10px;
background-color: #19B5FE;
color: white;
font-size: 12px;
line-height: 16px;
font-weight: 400;
margin: 0 5px 5px 0;
border-radius: 2px;
display: inline-block
}
.article-categories a:nth-child(5n) {
background-color: #4A4A4A;
color: #FFF
}
.article-categories a:nth-child(5n+1) {
background-color: #ff5e5c;
color: #FFF
}
.article-categories a:nth-child(5n+2) {
background-color: #ffbb50;
color: #FFF
}
.article-categories a:nth-child(5n+3) {
background-color: #1ac756;
color: #FFF
}
.article-categories a:nth-child(5n+4) {
background-color: #19B5FE;
color: #FFF
}
.article-categories a:hover {
background-color: #1B1B1B;
color: #FFF
}
.article-title {
position: relative;
margin-bottom: 15px;
font-size: 26px;
line-height: 1.3;
display: block;
font-weight: 400;
margin: 0 0 35px;
padding: 0 0 30px;
border-bottom: 1px solid #e7e7e7;
color: #FFF
}
打开主题文件夹中名为single.php的文件
查找tags
可以看到有一串以div开头的代码
<div class="article-tags"><?php the_tags('标签:','',''); ?></div>
将其修改为以下代码
<div class="article-categories"><?php the_tags('标签:','',''); ?></div>
以上为dux主题的代码,其他主题修改class后面的article-tags为article-categories即可
评论已关闭!