Typecho调用文章模块并增加判断是否在首页展示
调用相关文章、热门文章、最新文章的时候,可能会需要只在首页展示。
第一、Typecho相关文章调用
<?php $this->related(5)->to($relatedPosts); ?>
<ul>
<?php while ($relatedPosts->next()): ?>
<li><a href="<?php $relatedPosts->permalink(); ?>" title="<?php $relatedPosts->title(); ?>"><?php $relatedPosts->title(); ?></a></li>
<?php endwhile; ?>
</ul>
第二、判断是否为首页
<?php if($this->is('index')): ?>
//首页内容
<?php else: ?>
//不是首页内容
<?php endif; ?>
热门文章插件
https://www.boke8.net/typecho-tepostviews.html
本作品采用 知识共享署名-相同方式共享 4.0 国际许可协议 进行许可。