将Typecho后台的文章管理列表改为按时间排序 时间:2020年3月4日 分类:教程分享 评论:0 条 阅读:5548 次 typecho 文章管理列表 排序 # 前言 两年没升级Typecho程序了,最近更新发现后台的文章管理列表改为了按照cid的大小排列的,大的靠前 # 解决方法 # 1.解决排序问题 编辑`var/Widget/Contents/Post/Admin.php`的第176行(对比了几个版本都是这一行),将`$select->order('table.contents.cid', Typecho_Db::SORT_DESC)`,中的`cid`改为`created`即可。 ## 2.解决编辑文章时间后跳转到对应页面 编辑`var/Widget/Contents/Post/Edit.php`的第761行,将`$pageQuery = $this->getPageOffsetQuery($this->cid);`,中的`cid`也改为`created` 再将第198行到202行的 ```php protected function getPageOffsetQuery($cid, $status = NULL) { return 'page=' . $this->getPageOffset('cid', $cid, 'post', $status, 'on' == $this->request->__typecho_all_posts ? 0 : $this->user->uid); } ``` 修改为 ```php protected function getPageOffsetQuery($created, $status = NULL) { return 'page=' . $this->getPageOffset('created', $created, 'post', $status, 'on' == $this->request->__typecho_all_posts ? 0 : $this->user->uid); } ``` 本文由 血莲聆空 创作,采用 知识共享署名4.0 国际许可协议进行许可。本站文章除注明转载/出处外,均为本站原创或翻译,转载前请务必署名。最后编辑时间为:2020年3月13日 11:57:52