Answer the question
In order to leave comments, you need to log in
How to make an image responsive when displaying an image using php?
Good evening! I am doing the output of news in wp and bootstrap and I want the previews to be adaptive. Here is the code:
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<?php the_post_thumbnail();>
</a>
Answer the question
In order to leave comments, you need to log in
If this is WordPress + bootstrap, you can do this:
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<?php the_post_thumbnail(null, array("class" => "img-responsive")) ;?>
</a>
the_post_thumbnail
, the second parameter is used to set attributes (including classes)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question