How to add a CSS class to every image in a Custom Post Type
Combining the answer here by @cjcj with the code in this answer, the code that works for me outside the loop, in functions.php is: // Add ability to check for custom post type outside the loop. function is_post_type($type){ global $wp_query; if($type == get_post_type($wp_query->post->ID)) return true; return false; } // Add class to every image in … Read more