Support » How-To and Troubleshooting » [Resolved] Featured image, add image class

[Resolved] Featured image, add image class

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Michael


    Forum Moderator

    you could try to use the $attr of the the_post_thumbnail() function:

    for instance:

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

    where you replace ‘zoomer-class’ with the class required by your plugin.

    if that does not work (it should, tested in local install), you could try and add following filter function to functions.php of your theme:

    function add_class_to_thumbnail($thumb) {
    if( is_single() ) $thumb = str_replace('attachment-', 'zoomer-class attachment-', $thumb);
    return $thumb;

    Thanks, the first method worked a treat :]



    Second method works fine for me.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Featured image, add image class’ is closed to new replies.