将Typecho后台的文章管理列表改为按时间排序
分类:教程分享 评论:0条 阅读:4149次

将Typecho后台的文章管理列表改为按时间排序

分类:教程分享 评论:0条 阅读:4149次

前言

两年没升级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行的

    protected function getPageOffsetQuery($cid, $status = NULL)
    {
        return 'page=' . $this->getPageOffset('cid', $cid, 'post', $status,
        'on' == $this->request->__typecho_all_posts ? 0 : $this->user->uid);
    }

修改为

    protected function getPageOffsetQuery($created, $status = NULL)
    {
        return 'page=' . $this->getPageOffset('created', $created, 'post', $status,
        'on' == $this->request->__typecho_all_posts ? 0 : $this->user->uid);
    }
本篇文章评论已被关闭。