php - Bootstrap : adding img-responsive class to thumbnail

标签 php css wordpress twitter-bootstrap

我必须将 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/

相关文章:

php - 具有上下文的基于角色的访问控制(RBAC)?

javascript - Laravel:通过 min.js 文件 "Uncaught ReferenceError: HelloWeek is not defined"包含 javascript 代码

php - 如何创建自定义 Divi 模块?

php - 网站断断续续出现 'No data received' 错误代码 : ERR_EMPTY_RESPONSE

php - 在 div 中包装每三个 WordPress 帖子

css - 如何更新已经存在的@font-face 声明?

html - 在::之后更改悬停颜色?

html - 当显示多个文本行时,如何对齐内联 block 样式的 div 元素?

html - 从单个页面中删除导航

php - 如何在redux框架选项中显示上传或默认 Logo