Home  >  Article  >  Backend Development  >  Typecho如何首页分页以及文章分页

Typecho如何首页分页以及文章分页

WBOY
WBOYOriginal
2016-06-06 20:37:202295browse

因为经常写较长的文章所以为了美观需要进行首页分页,就是首页预览时只显示指定的部分内容,但是很可惜只会固定得修改index.php让每个文章展示固定的字数,请问如何设置每篇文章显示多少...第二个是首页文章列表如何分页显示...因为文章数量比较大。

回复内容:

因为经常写较长的文章所以为了美观需要进行首页分页,就是首页预览时只显示指定的部分内容,但是很可惜只会固定得修改index.php让每个文章展示固定的字数,请问如何设置每篇文章显示多少...第二个是首页文章列表如何分页显示...因为文章数量比较大。

你可以用自定义字段,然后首页用自定义字段显示你想要显示的内容,具体用法见:http://docs.typecho.org/help/custom-fields

另外首页文章正常应该就是分页的,后台设置里面可以设置每页显示多少篇文章。

如果需要一些高级的分页特性,譬如首页20页,搜索页面40页,那么可以考虑修改functions.php

譬如修改默认pageSize为20等。

<code>function themeInit($archive) {
    if ($archive->is('index')) {
        $archive->parameter->pageSize = 20; // 自定义条数
    }
}
</code>

其作用就是,主页中每页显示文章数由默认值改成20.
参考:typecho的皮肤函数

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn