/ Published in: PHP
                    
                                        
Check if current post type is a custom post type – WordPress. 
Returns a true/false-statement.
Can be used outside The Loop.
                Returns a true/false-statement.
Can be used outside The Loop.
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
function is_custom_post_type() {
global $wp_query;
foreach ($post_types as $post_type ) {
if (get_post_type($post_type->ID) == get_post_type($wp_query->post->ID)) {
return true;
} else {
return false;
}
}
}
Comments
 Subscribe to comments
                    Subscribe to comments
                
                