21 Feb 2018

If statement for custom post types

Here's a handy conditional snippet to target specific archive or single pages from a custom post type.

 


<?php if ((is_post_type_archive('cake-lovers') || is_singular( 'cake-lovers' ))) {

// Do something

} ?>