我必须将 img-responsive 类添加到 WordPress 页面模板中的图像中。 我的文件名为 single-product.php。
这是我的代码
<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>
现在我的问题是如何将类添加到缩略图?
请帮助我。
最佳答案
您可以在 the_thumbnail 函数中传递类名。
<?php the_post_thumbnail('thumbnail', array('class' => 'your-class-name')); ?>
更多引用 https://codex.wordpress.org/Function_Reference/the_post_thumbnail
关于php - Bootstrap : adding img-responsive class to thumbnail,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33580749/