最近在处理一个主题的时候刚好需要实现一下让博客首页文章目录把最新增加的文章放到最下面,所以查看了一下代码。
很明显,在输出文章时,有一个DESC,将他改为ASC即可

操作

找到/var/Widget/Archive.php文件中的

/** 仅输出文章 */
$this->_countSql = clone $select;

$select->order('table.contents.created', Typecho_Db::SORT_DESC)
->page($this->_currentPage, $this->parameter->pageSize);
$this->query($select);
}

替换内容

$select->order('table.contents.created', Typecho_Db::SORT_DESC)

替换为:

$select->order('table.contents.created', Typecho_Db::SORT_ASC)

再刷新首页查看,就看到文章倒序输出显示了


Last modification:March 8, 2020
如果觉得我的文章对你有用,请随意赞赏