Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap : adding img-responsive class to thumbnail

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.

like image 616
Sikander Avatar asked Dec 30 '25 01:12

Sikander


1 Answers

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


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!