And*_*son 2 twitter-bootstrap twitter-bootstrap-3
我正在使用bootstrap并希望将img-responsive和img-circle类应用于后缩略图.
问题是我不知道如何使图像缩略图的PHP代码在img标记内工作.
除非我可以标记它们,否则我不能应用类,并且div标签不起作用.
我确信它很简单,但会欣赏指针.
代码在这里 - 目前我已经在div标签中尝试了它,它获取图像但不适用于样式
<h4>Latest News</h4>
<?php $counter = 3;
$recentPosts = new WP_Query();
$recentPosts->query('showposts=3');?>
<?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>
<div>
<span class="glyphicon glyphicon-star"></span>
<div class="img-responsive img-circle"> <?php the_post_thumbnail(); ?> </div>
<p class="posttitle"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p>
<p class="smallprint"><?php the_date(); ?></p>
<div><?php the_excerpt(10); ?></div>
</div>
<?php endwhile; ?>
Run Code Online (Sandbox Code Playgroud)
我已经解决了这个问题
<?php the_post_thumbnail('thumbnail', array('class' => 'img-responsive img-circle')); ?>
Run Code Online (Sandbox Code Playgroud)
我们也可以用它
<?php echo get_the_post_thumbnail( $post_id, 'thumbnail', array('class' => 'img-responsive img-circle')); ?>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5446 次 |
| 最近记录: |