2014-10-09 108 views
0

我累了让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'); ?>它会工作。但我正在动态获取特色图片,而此方法无效。

回答

1

你很近。获得完全摆脱你img的标签和使用:

<?php 
the_post_thumbnail('jumbo_thumbnail', array(
    'alt' => 'Responsive image', 
    'class' => 'img-responsive' 
)); 
?> 

the_post_thumbnail功能将输出img标签为您服务。

+0

真棒,它的工作。谢谢。 – Lifestohack 2014-10-09 21:03:35

相关问题