【发布时间】:2015-07-17 17:31:44
【问题描述】:
我正在使用“Aqua Resizer”(aq_resizer.php) 来调整我的 Wordpress 网站上的缩略图大小。我的帖子是由single.php 中的循环制成的
<?php get_template_part( 'content', 'single' ); ?>
这来自content-single.php,其中包含我的帖子的代码
HTML
<div id="post-<?php the_ID(); ?>" <?php post_class('col-md-12'); ?> >
<div>
<h2><?php the_title(); ?></h2>
<h3><?php the_category(', '); ?></h3>
<?php the_content(); ?>
</div>
<?php
$thumb = get_post_thumbnail_id();
$img_url = wp_get_attachment_url( $thumb,'full' ); //get full URL to image (use "large" or "medium" if the images too big)
$image = aq_resize( $img_url, 1200, 720, true ); //resize & crop the image
?>
<?php if($image) : ?>
<img class="img-responsive" src="<?php echo $image ?>"/>
<?php endif; ?>
</div><!-- /#post -->
一切正常(调整大小功能适用于 <?php the_content(); ?> 引入的特色帖子。图像随着窗口大小的调整而放大/缩小
该效果有效,因为class="img-responsive" 已应用于帖子的特色图片。
我在帖子的内容中有图片。我希望他们以同样的方式行动(现在他们只是以原始大小被引入)我需要将 img-responsive 类应用于 <?php the_content(); ?> 中的图像
【问题讨论】:
-
我认为您需要检查
the_content()函数代码,并确保您可以使用该类将变量传递给它。
标签: php jquery html css wordpress