I have found some code for detecting a CPT:
https://wordpress.stackexchange.com/questions/6731/if-is-custom-post-type
Here it is:
To test if a post is any custom post type, fetch the list of all not built-in post types and test if the post’s type is in that list.
As a function:
/**
* Check if a post is a custom post type.
* @param mixed $post Post object or ID
* @return boolean
*/
function is_custom_post_type( $post = NULL )
{
$all_custom_post_types = get_post_types( array ( '_builtin' => FALSE ) );
// there are no custom post types
if ( empty ( $all_custom_post_types ) )
return FALSE;
$custom_types = array_keys( $all_custom_post_types );
$current_post_type = get_post_type( $post );
// could not detect current type
if ( ! $current_post_type )
return FALSE;
return in_array( $current_post_type, $custom_types );
}
Usage:
if ( is_custom_post_type() )
print 'This is a custom post type!';