如何使用Bootstrap使图像响应并在wordpress上使用它?
问题描述:
我累了让WordPress的特色图片响应bootstrap。使图像响应自举的方法是如何使用Bootstrap使图像响应并在wordpress上使用它?
<img src="..." class="img-responsive" alt="Responsive image">
动态显示功能的图像时,我厌倦了使用此方法在WordPress。
<img src="<?php the_post_thumbnail('jumbo_thumbnail'); ?>" class="img-responsive" alt="Responsive image">
但它不工作。我知道,如果我把一个链接,而不是<?php the_post_thumbnail('jumbo_thumbnail'); ?>
它会工作。但我正在动态获取特色图片,而此方法无效。
答
你很近。获得完全摆脱你img
的标签和使用:
<?php
the_post_thumbnail('jumbo_thumbnail', array(
'alt' => 'Responsive image',
'class' => 'img-responsive'
));
?>
the_post_thumbnail
功能将输出img
标签为您服务。
真棒,它的工作。谢谢。 – Lifestohack 2014-10-09 21:03:35