Add this to your functions.php, and you can have the functionality, inside or outside of the loop:
1 2 3 4 5 6 | function is_post_type($type){ global $wp_query; if($type == get_post_type($wp_query->post->ID)) return true; return false; } |
So you can now use the following:
1 2 3 | if (is_single() && is_post_type('post_type')){ // Work magic } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.