Conditional tag is_page with a custom post type

The creation of a custom post type have it inside the definition, a post type. Also is page only a default post type. If you register your custom post type, then check for this post type, not for a page.

Conditional Tag is_singular

The function, conditional tag is_singular() main purpose is to check if viewing a singular post. However, it can also be used to check if viewing a singular post of a given post type by entering the $post_type parameter as shown in the following code snippet.

is_singular( 'your_custom_post_type' );

or different post types

is_singular( array( 'your_custom_post_type_1', 'your_custom_post_type_2' ) );

Hint to debug

I use the plugin Debug Objects to debug topics in this context.
Maybe this helps you also, often easier as read the code or codex.
See the follow screenshot of the plugin, the result of the conditional tags, include is_page() and is_single() on a CPT.
enter image description here

Leave a Comment