作者:朱某不爱说话
文章:joe主题添加普通样式标签云
阅读:2474
分类:网络技术
发布:2023-04-08
1.查找 functions.php 文件中的内容
$JAside_3DTag = new Typecho_Widget_Helper_Form_Element_Select(
'JAside_3DTag',
array(
'off' => '关闭(默认)',
'on' => '开启'
),
'off',
'是否开启3D云标签 - PC',
'介绍:用于设置侧边栏是否显示3D云标签'
);
$JAside_3DTag->setAttribute('class', 'joe_content joe_aside');
$form->addInput($JAside_3DTag->multiMode());
修改为:
$JAside_Tag = new Typecho_Widget_Helper_Form_Element_Select(
'JAside_Tag',
array(
'off' => '关闭(默认)',
'1' => '3D云标签',
'2' => '普通标签',
),
'off',
'是否开启标签 - PC',
'介绍:用于设置侧边栏是否显示标签'
);
$JAside_Tag->setAttribute('class', 'joe_content joe_aside');
$form->addInput($JAside_Tag->multiMode());
2.查找 public/aside.php 文件中的内容
<?php if ($this->options->JAside_3DTag === 'on') : ?>
修改为:
<?php if ($this->options->JAside_Tag !== 'off') : ?>
3.查找 public/aside.php 文件中的内容
<div class="tag"></div>
<ul class="list" style="display: none;">
<?php while ($tags->next()) : ?>
<li data-url="<?php $tags->permalink(); ?>" data-label="<?php $tags->name(); ?>"></li>
<?php endwhile; ?>
</ul>
修改为:
<?php if ($this->options->JAside_Tag === '1') : ?>
<div class="tag"></div>
<ul class="list" style="display: none;">
<?php while ($tags->next()) : ?>
<li data-url="<?php $tags->permalink(); ?>" data-label="<?php $tags->name(); ?>"></li>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<?php if ($this->options->JAside_Tag === '2') : ?>
<div class="common-tags">
<?php while ($tags->next()) : ?>
<a class="common-tag" href="<?php $tags->permalink(); ?>"
title="<?php $tags->name(); echo ' ('; $tags->count(); echo ')'; ?>">
<?php $tags->name(); ?>
</a>
<?php endwhile; ?>
</div>
<?php endif; ?>
4.查找 public/include.php 文件中的内容
<?php if ($this->options->JAside_3DTag === 'on') : ?>
修改为:
<?php if ($this->options->JAside_Tag !== 'off') : ?>
5.添加 CSS 样式
在主题 aside.php 文件最底部添加以下代码
<style>
.common-tag {
height: 30px;
font-size: 12px;
border-radius: 5px;
display: block;
line-height: 30px;
overflow: hidden;
text-overflow: ellipsis;
background: var(--classD);
color: var(--routine);
padding: 0 5px;
text-align: center;
}
.common-tag:hover {
background: var(--theme);
color: #fff;
}
.common-tags {
display: grid;
grid-row-gap: 8px;
grid-column-gap: 8px;
grid-template-columns: repeat(3, calc((100% - 16px) / 3));
}
</style>
版权属于:
朱某不爱说话
作品采用:
《
署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)
》许可协议授权