判断当前内容类型的代码

如果当前页面的内容类型符合设定,则返回True:

<?php
$match = FALSE ;
$types = array( 'book' => 1 );   //此处设定内容类型

if (( arg ( 0 ) == 'node' ) && is_numeric ( arg ( 1 ))) {
$node = node_load ( arg ( 1 ));
$match = isset( $types [ $node -> type ]);
}

$match |= (( arg ( 0 ) == 'taxonomy' ) && ( arg ( 1 ) == "term" )); 

return $match ;
?>