版主: woniou
由 Constantine123 » 2014年 6月 4日 11:24
由 hanabi » 2014年 6月 4日 12:09
/**
* 主题配置函数
*/
function themeConfig($form)
{
$notice = new Typecho_Widget_Helper_Form_Element_Textarea('notice', NULL, NULL, _t('公告'), _t('侧边栏公告'));
$form->addInput($notice);
}
<!-- 公告牌 -->
<div class="notice" itemprop="description">
<?php $this->options->notice(); ?>
</div>
.notice {
Your css style.......
}
由 jazzi » 2016年 4月 12日 07:13
hanabi 写道:其实不用插件实现就好:
新建一个functions.php文件(本身主题有带的话就不用),加入以下代码:
- 代码: 全选
/**
* 主题配置函数
*/
function themeConfig($form)
{
$notice = new Typecho_Widget_Helper_Form_Element_Textarea('notice', NULL, NULL, _t('公告'), _t('侧边栏公告'));
$form->addInput($notice);
}
然后在sidebar.php中适当位置加入以下代码:
- 代码: 全选
<!-- 公告牌 -->
<div class="notice" itemprop="description">
<?php $this->options->notice(); ?>
</div>
自定义的css样式可以用:
- 代码: 全选
.notice {
Your css style.......
}
后台添加、删除、更改公告如图,在后台外观中,点击主题的“设置外观”进行配置:
由 weich » 2019年 1月 22日 02:04
jazzi 写道:hanabi 写道:其实不用插件实现就好:
新建一个functions.php文件(本身主题有带的话就不用),加入以下代码:
- 代码: 全选
/**
* 主题配置函数
*/
function themeConfig($form)
{
$notice = new Typecho_Widget_Helper_Form_Element_Textarea('notice', NULL, NULL, _t('公告'), _t('侧边栏公告'));
$form->addInput($notice);
}
然后在sidebar.php中适当位置加入以下代码:
- 代码: 全选
<!-- 公告牌 -->
<div class="notice" itemprop="description">
<?php $this->options->notice(); ?>
</div>
自定义的css样式可以用:
- 代码: 全选
.notice {
Your css style.......
}
后台添加、删除、更改公告如图,在后台外观中,点击主题的“设置外观”进行配置:
太棒了,正是我需要的。谢谢!