URCloud

/ 0评 / 0/ 最后更新:2021-12-08
typecho隐藏首页某一分类下的文章

场景需求

有些博主想要做一些特殊的需求,比如本站,摄影模块就是特殊处理,摄影分类并不在首页展示。

解决方案

thePrev方法$content部分代码替换如下,13为摄影分类mid

 $content = $this->db->fetchRow($this->select()->from('table.contents')
            ->join('table.relationships', 'table.relationships.cid = table.contents.cid')
            ->where('table.relationships.mid != ?', '13')
            ->where('table.contents.created < ?',$this->created)
            ->where('table.contents.status = ?', 'publish')
            ->where('table.contents.type = ?', $this->type)
            ->where('table.contents.password IS NULL')
            ->order('table.contents.created', Typecho_Db::SORT_DESC)
            ->limit(1));

theNext方法$content部分代码替换如下,13为摄影分类mid

 $content = $this->db->fetchRow($this->select()
        ->join('table.relationships', 'table.relationships.cid = table.contents.cid')
        ->where('table.relationships.mid != ?', '13')
        ->where('table.contents.created > ? AND table.contents.created < ?',$this->created, $this->options->time)
        ->where('table.contents.status = ?', 'publish')
        ->where('table.contents.type = ?', $this->type)
        ->where('table.contents.password IS NULL')
        ->order('table.contents.created', Typecho_Db::SORT_ASC)
        ->limit(1));

0

Leave a Reply

Your email address will not be published.