oldPosts function
This commit is contained in:
parent
a119482cf4
commit
046482f9f0
|
@ -17,6 +17,13 @@ function themeConfig($form) {
|
||||||
|
|
||||||
$notification = new Typecho_Widget_Helper_Form_Element_Text('notification', NULL, NULL, _t('网站公告'), _t('显示在首页,留空则不显示'));
|
$notification = new Typecho_Widget_Helper_Form_Element_Text('notification', NULL, NULL, _t('网站公告'), _t('显示在首页,留空则不显示'));
|
||||||
$form->addInput($notification);
|
$form->addInput($notification);
|
||||||
|
|
||||||
|
$oldPosts = new Typecho_Widget_Helper_Form_Element_Radio('oldPosts',
|
||||||
|
array('able' => _t('启用'),
|
||||||
|
'disable' => _t('禁用'),
|
||||||
|
),
|
||||||
|
'disable', _t('是否显示旧文提示'), _t('启用则会在一年前发布的文章页面显示“这是一篇旧文”'));
|
||||||
|
$form->addInput($oldPosts);
|
||||||
}
|
}
|
||||||
|
|
||||||
function themeFields($layout) {
|
function themeFields($layout) {
|
||||||
|
|
13
post.php
13
post.php
|
@ -18,6 +18,19 @@
|
||||||
<?php endif;?>
|
<?php endif;?>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
|
<?php
|
||||||
|
$date1=date_create(date('c',$this->date->timeStamp));
|
||||||
|
$date2=date_create(date('c'));
|
||||||
|
$days=date_diff($date1,$date2);
|
||||||
|
?>
|
||||||
|
<?php if ($this->options->oldPosts == 'able' && $days->format('%a') > 365): ?>
|
||||||
|
<div class="alert alert-primary shadow mb-5" role="alert">
|
||||||
|
这是一篇发布于 <?php echo $days->format('%a'); ?> 天以前的旧文。其中的部分内容可能已经过时。
|
||||||
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||||
|
<span aria-hidden="true" class="text-white">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
<div class="post-content" itemprop="articleBody">
|
<div class="post-content" itemprop="articleBody">
|
||||||
<?php $this->content(); ?>
|
<?php $this->content(); ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue