尝试
function has_type( $type, $_post = null ) {
if ( empty( $type) )
return false;
if ( $_post )
$_post = get_post( $_post );
else
$_post =& $GLOBALS[\'post\'];
if ( !$_post )
return false;
$r = is_object_in_term( $_post->ID, \'type\', $type);
if ( is_wp_error( $r ) )
return false;
return $r;
}
用法:
<?php if ( has_type( \'Photography\' ) ) /* do your thing*/ ?>
希望这有帮助。