Skip to content

Commit db80581

Browse files
LightLight
authored andcommitted
refactor: 支持填写带 fa- 前缀的分类缩略名
1 parent b486d89 commit db80581

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646

4747
在后台的分类管理页面(默认:`/admin/manage-categories.php`)中可以添加或编辑分类,其对应导航页中左侧边栏里的菜单项,一般可以按照网址的类别来进行分类。
4848

49+
填写分类缩略名可实现为菜单项显示图标的功能,例如在分类缩略名处填写 `book` 或者 `fa-book` 时,将在菜单项前面显示一个书本的小图标。具体可用的分类缩略名可以查看:[Font Awesome Icons](https://fontawesome.com/v4/icons/)
50+
4951
### 添加项目
5052

5153
在后台的文章管理页面(默认:`/admin/manage-posts.php`)中可以添加或编辑具体的网址导航项目。

src/functions.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,28 +220,28 @@ function themeConfig($form)
220220
// 顶部模块 蓝色 文字自定义
221221
$zmki_top_main_one_name = new Typecho_Widget_Helper_Form_Element_Text('zmki_top_main_one_name', NULL, '项目地址', _t('<span style="color: #608cee; margin-right:0px;">蓝色模块文字</span>'), _t('输入顶部蓝色模块内的文字,默认 项目地址'));
222222
$form->addInput($zmki_top_main_one_name);
223-
$zmki_top_main_one_icon = new Typecho_Widget_Helper_Form_Element_Text('zmki_top_main_one_icon', NULL, 'fa fa-safari', _t('<span style="color: #608cee; margin-right:0px;">蓝色模块</span>图标'), _t('自定义蓝色模块内文字前的 Font Awesome 图标,图标帮助可查看:<a target="_blank" href="http://www.fontawesome.com.cn/icons-ui/">Font Awesome 中文网</a>,蓝色默认 fa fa-safari'));
223+
$zmki_top_main_one_icon = new Typecho_Widget_Helper_Form_Element_Text('zmki_top_main_one_icon', NULL, 'fa fa-safari', _t('<span style="color: #608cee; margin-right:0px;">蓝色模块</span>图标'), _t('自定义蓝色模块内文字前的 Font Awesome 图标,图标帮助可查看:<a target="_blank" href="https://fontawesome.com/v4/icons/">Font Awesome Icons</a>,蓝色默认 fa fa-safari'));
224224
$form->addInput($zmki_top_main_one_icon);
225225
$zmki_top_main_one_url = new Typecho_Widget_Helper_Form_Element_Text('zmki_top_main_one_url', NULL, 'https://github.com/LightAPIs/WebStackTypechoTheme', _t('<span style="color: #608cee; margin-right:0px;">蓝色模块</span>跳转链接'), _t('输入蓝色模块跳转的链接,'));
226226
$form->addInput($zmki_top_main_one_url);
227227
// 顶部模块 红色 文字自定义
228228
$zmki_top_main_two_name = new Typecho_Widget_Helper_Form_Element_Text('zmki_top_main_two_name', NULL, 'WebStack_钻芒二开版', _t('<span style="color: #fb5962; margin-right:0px;">红色模块文字</span>'), _t('输入顶部红色模块内的文字,默认 WebStack_钻芒二开版'));
229229
$form->addInput($zmki_top_main_two_name);
230-
$zmki_top_main_two_icon = new Typecho_Widget_Helper_Form_Element_Text('zmki_top_main_two_icon', NULL, 'fa fa-star', _t('<span style="color: #fb5962; margin-right:0px;">红色模块</span>图标'), _t('自定义红色模块内文字前的 Font Awesome 图标,图标帮助可查看:<a target="_blank" href="http://www.fontawesome.com.cn/icons-ui/">Font Awesome 中文网</a>,红色默认 fa fa-star'));
230+
$zmki_top_main_two_icon = new Typecho_Widget_Helper_Form_Element_Text('zmki_top_main_two_icon', NULL, 'fa fa-star', _t('<span style="color: #fb5962; margin-right:0px;">红色模块</span>图标'), _t('自定义红色模块内文字前的 Font Awesome 图标,图标帮助可查看:<a target="_blank" href="https://fontawesome.com/v4/icons/">Font Awesome Icons</a>,红色默认 fa fa-star'));
231231
$form->addInput($zmki_top_main_two_icon);
232232
$zmki_top_main_two_url = new Typecho_Widget_Helper_Form_Element_Text('zmki_top_main_two_url', NULL, 'https://github.com/wclk/WebStack_ZMKI', _t('<span style="color: #fb5962; margin-right:0px;">红色模块</span>跳转链接'), _t('输入红色模块跳转的链接,'));
233233
$form->addInput($zmki_top_main_two_url);
234234
// 顶部模块 黄色 文字自定义
235235
$zmki_top_main_three_name = new Typecho_Widget_Helper_Form_Element_Text('zmki_top_main_three_name', NULL, 'WebStack', _t('<span style="color: #fbb359; margin-right:0px;">黄色模块文字</span>'), _t('输入顶部黄色模块内的文字,默认 WebStack'));
236236
$form->addInput($zmki_top_main_three_name);
237-
$zmki_top_main_three_icon = new Typecho_Widget_Helper_Form_Element_Text('zmki_top_main_three_icon', NULL, 'fa fa-registered', _t('<span style="color: #fbb359; margin-right:0px;">黄色模块</span>图标'), _t('自定义黄色模块内文字前的 Font Awesome 图标,图标帮助可查看:<a target="_blank" href="http://www.fontawesome.com.cn/icons-ui/">Font Awesome 中文网</a>,黄色默认 fa fa-registered'));
237+
$zmki_top_main_three_icon = new Typecho_Widget_Helper_Form_Element_Text('zmki_top_main_three_icon', NULL, 'fa fa-registered', _t('<span style="color: #fbb359; margin-right:0px;">黄色模块</span>图标'), _t('自定义黄色模块内文字前的 Font Awesome 图标,图标帮助可查看:<a target="_blank" href="https://fontawesome.com/v4/icons/">Font Awesome Icons</a>,黄色默认 fa fa-registered'));
238238
$form->addInput($zmki_top_main_three_icon);
239239
$zmki_top_main_three_url = new Typecho_Widget_Helper_Form_Element_Text('zmki_top_main_three_url', NULL, 'https://github.com/WebStackPage/WebStackPage.github.io', _t('<span style="color: #fbb359; margin-right:0px;">黄色模块</span>跳转链接'), _t('输入黄色模块跳转的链接,'));
240240
$form->addInput($zmki_top_main_three_url);
241241
// 顶部模块 绿色 文字自定义
242242
$zmki_top_main_four_name = new Typecho_Widget_Helper_Form_Element_Text('zmki_top_main_four_name', NULL, 'Typecho', _t('<span style="color: #53bf6b; margin-right:0px;">绿色模块文字</span>'), _t('输入顶部绿色模块内的文字,默认 Typecho'));
243243
$form->addInput($zmki_top_main_four_name);
244-
$zmki_top_main_four_icon = new Typecho_Widget_Helper_Form_Element_Text('zmki_top_main_four_icon', NULL, 'fa fa-diamond', _t('<span style="color: #53bf6b; margin-right:0px;">绿色模块</span>图标'), _t('自定义绿色模块内文字前的 Font Awesome 图标,图标帮助可查看:<a target="_blank" href="http://www.fontawesome.com.cn/icons-ui/">Font Awesome 中文网</a>,绿色默认 fa fa-diamond'));
244+
$zmki_top_main_four_icon = new Typecho_Widget_Helper_Form_Element_Text('zmki_top_main_four_icon', NULL, 'fa fa-diamond', _t('<span style="color: #53bf6b; margin-right:0px;">绿色模块</span>图标'), _t('自定义绿色模块内文字前的 Font Awesome 图标,图标帮助可查看:<a target="_blank" href="https://fontawesome.com/v4/icons/">Font Awesome Icons</a>,绿色默认 fa fa-diamond'));
245245
$form->addInput($zmki_top_main_four_icon);
246246
$zmki_top_main_four_url = new Typecho_Widget_Helper_Form_Element_Text('zmki_top_main_four_url', NULL, 'https://typecho.org/', _t('<span style="color: #53bf6b; margin-right:0px;">绿色模块</span>跳转链接'), _t('输入绿色模块跳转的链接,'));
247247
$form->addInput($zmki_top_main_four_url);

src/sidebar.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616
<li>
1717
<a href="<?php if ($this->is('index')): ?><?php else: ?>/<?php endif; ?>#<?php $categorys->name(); ?>"
1818
class="smooth">
19-
<i class="fa fa-<?php $categorys->slug(); ?>"></i>
19+
<i class="fa fa-<?php echo str_replace('fa-', '', $categorys->slug); ?>"></i>
2020
<span class="title"><?php $categorys->name(); ?></span>
2121
</a>
2222
</li>
2323
<?php } else { ?>
2424
<li>
2525
<a>
26-
<i class="fa fa-<?php $categorys->slug(); ?>"></i>
26+
<i class="fa fa-<?php echo str_replace('fa-', '', $categorys->slug); ?>"></i>
2727
<span class="title"><?php $categorys->name(); ?></span>
2828
</a>
2929
<ul>

0 commit comments

Comments
 (0)