Skip to content

Commit 1189c67

Browse files
committed
feat: 增加简单的全站的公告
1 parent 079dd99 commit 1189c67

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

index.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
<div class="col-lg-9 col-md-9 col-sm-9 col-xs-9 main">
2626
<?php $this->need('component/index.toolbar.php'); ?>
2727
<?php $this->need('component/index.category.php'); ?>
28+
<?php if ($this->options->notice): ?>
29+
<div class="alert alert-primary" role="alert">
30+
<?php $this->options->notice(); ?>
31+
</div>
32+
<?php endif; ?>
2833
<?php $this->need('component/index.banner.php') ?>
2934
<div class="articles">
3035
<?php $this->need('component/index.article.php'); ?>

libs/options.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ function themeConfig($form)
9595
EOF;
9696
echo '<script src="' . Helper::options()->themeUrl . '/assets/js/setting.js"></script>';
9797

98+
$notice = new \Typecho\Widget\Helper\Form\Element\Text('notice', NULL, NULL, '公告', '只会在首页显示');
99+
$notice->setAttribute('class', 'theme-setting-content theme-setting-global');
100+
$form->addInput($notice);
101+
98102
$darkBtn = new \Typecho\Widget\Helper\Form\Element\Radio('darkBtn',
99103
array(1 => '启用',
100104
0 => '关闭'),

0 commit comments

Comments
 (0)