Adding Class to WordPress Post Thumbnail

November 27, 2014

If the desired output of the default WordPress post thumbnail is not enough you can easily adjust the PHP to output your appropriate class.

<?php
    the_post_thumbnail('post-thumbnail',
      array( 'class' => "YOUR CLASS"));
?>

More information can be found on the codex.

Join over 30,000 developers & designers who get the best news and articles delivered right to their inbox each week.