I have to add img-responsive class to an image in wordpress page template. My file is named as single-product.php.
This is my code
<div class="col-md-6 col-xs-12" style="margin-top:35px;">
<h1><?php the_title();?></h1>
</div>
<div class="col-md-6 col-xs-12">
<?php the_post_thumbnail();?>
</div>
Now my question is how to add class to thumbnail?
Please assist me.
You can pass the class name in the_thumbnail function .
<?php the_post_thumbnail('thumbnail', array('class' => 'your-class-name')); ?>
For More Refrence https://codex.wordpress.org/Function_Reference/the_post_thumbnail
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With