frankyonnetti
4/26/2016 - 9:21 PM

#wordpress

WordPress - if custom post type #wordpress #post-type

<?php

// Theis is true when viewing a post of the custom post type: book.
if ( is_singular( 'book' ) ) {
  // conditional content/code
}

// This is true when viewing a post of the custom post types: newspaper or book.
if ( is_singular( array( 'newspaper', 'book' ) ) ) {
  //  conditional content/code
}

if ( get_post_type( get_the_ID() ) == 'announcements' ) {
  echo 'announcements';
}