许多朋友可能会由于各种需求不想在zblogphp博客的首页显示某个分类的文章,那么如何实现呢?其实zblogphp应用中心有这样的插件,但是有些朋友又不想使用插件,那么有没有办法实现呢?经过网上的各种资料搜集测试,亲测无错可用。
实现方法:
1、在主题的include.php文件最后一行的 ?> 上面添加以下函数代码:
function Exclude_Category(&$type,&$page,&$category,&$author,&$datetime,&$tag,&$w,&$pagebar){ global $zbp; if($type == 'index'){//这里只是在首页隐藏,像tag页面,author页面,datetime页面等,可以按需使用. $w[]=array('<>','log_CateID',1); //下面是重建分页 $pagebar = new Pagebar($zbp->option['ZC_INDEX_REGEX']); $pagebar->PageCount = $zbp->displaycount; $pagebar->PageNow = $page; $pagebar->PageBarCount = $zbp->pagebarcount; } }
以上代码第四行中的1是要排除的分类ID,分类ID请在后台分类管理中查看。
2、还是在主题的include.php文件function ActivePlugin_主题ID(){ 后面加以下代码:
Add_Filter_Plugin('Filter_Plugin_ViewList_Core','exclude_category');
保存后即可生效!如果还有不明白的,可以联系我!
发表评论