You can add a CSS class to a featured image in WordPress using an array in the_post_thumbnail

 

 if( has_post_thumbnail() ) {
//Add in featured image & class
 the_post_thumbnail( 'featured-podcast', array( 'class' => 'alignnone' ) ); 
 }

View the code on Gist.

This can be handy for coding out a custom loop.

Share:

Leave a Reply