很多企业站点分类都不一样,比如产品分类,新闻分类长相都是不一样,包括博客站,BIT主题是用判断的方式,如果没有则显示默认,下面展示。
在分类文件category.php写入判断代码
<?php $text_archived = of_get_option('categoryd', ''); //这里是多选项,可以放入多个分类ID,只适用于BIT主题,其中别的主题需要使用的话,需要删除of_get_option $text_archived_arr = explode(',',$text_archived); $text_archivec = of_get_option('categoryc', ''); // $text_archivec_arr = explode(',',$text_archivec); $text_archiveb = of_get_option('categoryb', ''); // $text_archiveb_arr = explode(',',$text_archiveb); if (is_category($text_archived_arr)){ include(TEMPLATEPATH . '/category/categoryd.php'); //这里是模板D }elseif (is_category($text_archivec_arr)){ include(TEMPLATEPATH . '/category/categoryc.php');//这里是模板C }elseif (is_category($text_archiveb_arr)){ include(TEMPLATEPATH . '/category/categoryb.php');//这里是模板B }else{ include(TEMPLATEPATH . '/category/categorya.php'); //如果都没有则输出默认模板 } ?>
然后再新建一个category放置分类模板文件夹,里面放入category(a、b、c、d)
效果展示: