增加了相关文章的设置

6篇
This commit is contained in:
浪子 2024-05-18 21:36:18 +08:00
parent f23e6fad65
commit 3cc50df415
4 changed files with 32 additions and 2 deletions

View File

@ -96,7 +96,7 @@ function threadedComments($comments, $options) {
</div>
<div class="comment--meta">
<div class="comment--author"><?php echo $comments->author; ?><span class="dot"></span>
<div class="comment--time"><?php $comments->date('Y-m-d'); ?></div>
<div class="comment--time"><?php $comments->date('Y-m-d H:i'); ?></div>
<span class="comment-reply-link u-cursorPointer">
<?php $comments->reply('<svg viewBox="0 0 24 24" width="14" height="14" aria-hidden="true" class="" ><g><path d="M12 3.786c-4.556 0-8.25 3.694-8.25 8.25s3.694 8.25 8.25 8.25c1.595 0 3.081-.451 4.341-1.233l1.054 1.7c-1.568.972-3.418 1.534-5.395 1.534-5.661 0-10.25-4.589-10.25-10.25S6.339 1.786 12 1.786s10.25 4.589 10.25 10.25c0 .901-.21 1.77-.452 2.477-.592 1.731-2.343 2.477-3.917 2.334-1.242-.113-2.307-.74-3.013-1.647-.961 1.253-2.45 2.011-4.092 1.78-2.581-.363-4.127-2.971-3.76-5.578.366-2.606 2.571-4.688 5.152-4.325 1.019.143 1.877.637 2.519 1.342l1.803.258-.507 3.549c-.187 1.31.761 2.509 2.079 2.629.915.083 1.627-.356 1.843-.99.2-.585.345-1.224.345-1.83 0-4.556-3.694-8.25-8.25-8.25zm-.111 5.274c-1.247-.175-2.645.854-2.893 2.623-.249 1.769.811 3.143 2.058 3.319 1.247.175 2.645-.854 2.893-2.623.249-1.769-.811-3.144-2.058-3.319z"></path></g></svg>'); ?>
</span>

View File

@ -38,8 +38,12 @@ function themeConfig($form) {
$form->addInput($showProfile);
$showallwords = new Typecho_Widget_Helper_Form_Element_Radio('showallwords',
array('0'=> _t('否'), '1'=> _t('是')),
'0', _t('是否显示归档字数统计'), _t('选择“是”将归档页面显示全站总字数。'));
'0', _t('是否显示归档字数统计'), _t('选择“是”将归档页面显示全站总字数。'));
$form->addInput($showallwords);
$showrelated = new Typecho_Widget_Helper_Form_Element_Radio('showrelated',
array('0'=> _t('否'), '1'=> _t('是')),
'0', _t('是否显示相关文章'), _t('选择“是”将在文章页面显示相关文章。'));
$form->addInput($showrelated);
}
function get_post_view($archive) {
$cid = $archive->cid;

View File

@ -68,6 +68,11 @@
<?php if ($this->options->showProfile): ?>
<?php $this->need('profile.php'); ?>
<?php endif; ?>
<!-- 相关文章-->
<?php if ($this->options->showrelated): ?>
<?php $this->need('related.php'); ?>
<?php endif; ?>
<!-- 判断如果禁止评论则不显示评论的div -->
<?php if ($this->allow('comment')): ?>
<?php $this->need('comments.php'); ?>

21
related.php Normal file
View File

@ -0,0 +1,21 @@
<div class="related--content">
<h3 class="related--posts__title">相关文章</h3>
<div class="post--single__related">
<?php $this->related(6)->to($relatedPosts); ?>
<?php while ($relatedPosts->next()): ?>
<div class="post--single__related__item">
<a href="<?php $relatedPosts->permalink(); ?>">
<div class="post--single__related__item__img">
</div>
<div class="post--single__related__item__title">
<?php $relatedPosts->title(25); ?>
</div>
<div class="meta">
<time class="humane--time"><?php $relatedPosts->date('Y-m-d'); ?></time>
</div>
</a>
</div>
<?php endwhile; ?>
</div>
</div>