zblog禁止首页显示某些分类的文章
进入/网站根目录/zb_users/theme/你使用的主题
打开include.php文件
在php代码中添加以下代码(末行的"?>"前):
function exclude_category(&$type,&$page,&$category,&$author,&$datetime,&$tag,&$w,&$pagebar){
global $zbp;
if($type == 'index'){
$w[]=array('<>','log_CateID',7); //7为你不像显示的文章分类ID
//以下是为了重建分页,过滤了分类,数量会发生变化
$pagebar = new Pagebar($zbp->option['ZC_INDEX_REGEX']);
$pagebar->PageCount = $zbp->displaycount;
$pagebar->PageNow = $page;
$pagebar->PageBarCount = $zbp->pagebarcount;
}
}文章分类ID可以在Zblog后台分类管理中查看。
仔细查看include.php文件,找到当前主题的加载函数(function ActivePlugin_主题名)
在函数题中添加代码:
Add_Filter_Plugin('Filter_Plugin_ViewList_Core','exclude_category');保存include.php文件 刷新主页试试
