Check if post is a $type custom post type, inside or outside of the loop. Ex: if ( is_post_type( 'book' ) ) {}
function is_post_type($type){ global $wp_query; if($type == get_post_type($wp_query->post->ID)) return true; return false; }