Check if is Custom Post Type

Here are a few handy if ( ) statements to show particular content based on the Custom Post Type.

Usage:

This will show if you are in a Book Single page or Book Archive / Taxonomy Page.

if ( 'book' == get_post_type() ) {
  // code here
}

This will show only if you are on the Book Single page.

if ( is_singular( 'book' ) ) {
  // code here
}

This will show if you are on a Book Single or Newspaper Single Page.

if ( is_singular( array( 'newspaper', 'book' ) ) ) {
  // code here
}