Add Post Class if Post has thumbnail

Add this snippet to your functions.php file to add a post class to any post that uses a featured image.

Code Snippet:

<?php
// add class if post has thumbnail
function has_thumb_class($classes) {
	global $post;
	if( has_post_thumbnail($post->ID) ) { $classes[] = 'has_thumb'; }

		return $classes;
}
add_filter('post_class', 'has_thumb_class');
?>

Posted in Posts, Conditional