How to exclude the specified classified article code from the zblog homepage list

Exhibition of works zero five hundred and ten

By default, the zblog home page list displays the articles of the whole site according to the time when they are published. If you do not want to display a classified article in the home page article circular list, you need to modify it through code or plug-ins. The following is a code tutorial that implements the zblog home page article list to exclude articles of the specified classification.

 How to exclude the specified classified article code from the zblog homepage list

1. Add the following function code to the theme include.php file:

 function qiteen_exclude_category(&$type,&$page,&$category,&$author,&$datetime,&$tag,&$w,&$pagebar){ global $zbp;     if($type == 'index'){ $w[]=array('<>','log_CateID',1); //The following is to rebuild the paging, filter the classification, and the quantity will change $pagebar = new Pagebar($zbp->option['ZC_INDEX_REGEX']); $pagebar->PageCount = $zbp->displaycount; $pagebar->PageNow = $page; $pagebar->PageBarCount = $zbp->pagebarcount; }    }

code array('<>','log_CateID',1) The number 1 in is the classification ID to exclude

2. In the ActivePlugin_xxx() Add the following code to the function:


After saving, the cache can be updated on the background home page to take effect.

Method analysis:

Specify the classification through function filtering, rebuild the paging, and hook Filter_Plugin_ViewList_Core Interface.

Interface location: zb_system/function/c_system_event.php. If you are interested, you can study it yourself.

Code transferred from blog

Related recommendations:

Message from netizens:

I would like to comment:

◎ Welcome to participate in the discussion. Please express your views and exchange your views here.
 Verification Code