2010-01-27 78 views
0

我想隐藏这个特定的博客和其他网页我有这样的代码:隐藏一个DIV在侧边栏的WordPress

<?php if (is_page(array ('2','4','6','8','10','12'))) : ?> 
<?php else : ?> 
<?php include('stats.php');?> 
<?php endif; ?> 

它不会显示在2,6,8,10,12这是页面,但它在4的鞋,这是博客请帮助。

回答

0

假设“博客”是一个类别,它的ID是4,你不想看该类别的档案页面时,包括“stats.php”:

<?php if (!is_page(array('2','4','6','8','10','12')) && !is_category('4')) { 
    include('stats.php'); 
} ?> 

否则,参考文档为Wordpress conditional tags

+0

感谢这工作,因为我的peramlink不工作我把它作为<?php if(!is_page(array('2','4','6','8','10','12' ))&&!is_single('4')){('stats.php'); }?> – 2010-01-27 20:22:29