在高级自定义字段插件

时间:2016-12-04 13:32:30

标签: php wordpress twitter-bootstrap advanced-custom-fields

我正在使用bootstrap和Advanced Custom Fields插件。我创建了一个图像区域,但图像没有响应。任何人都可以提供帮助并有任何建议如何编辑此代码以使图像在小屏幕上响应。

链接到我的网站:http://vizionstar.co.uk/global_listings/

这是我用来从front-page.php获取图像的代码:

if(get_field('testimonial_content')) {
    echo '<div class="info-box-container">';

    $image = get_field('Image');
          $size = 'full'; 

          if( $image ) {

            echo wp_get_attachment_image( $image, $size ); 
          }

    echo '<h3>' . get_field('testimonial_title') . '</h3>';
    echo '<h1>' . get_field('testimonial_title2') . '</h1>';                
    echo '<h1>' . get_field('testimonial_title3') . '</h1>';
    the_field('testimonial_content');
    echo '</div>'; 
}

图片出现在推荐书栏目“行业对我们说的是什么”。

2 个答案:

答案 0 :(得分:1)

最简单的方法是将它添加到style.css:

.info-box img {
   max-width: 100%;
   height: auto;
}

答案 1 :(得分:0)

尝试将此行添加到CSS文件

img.attachment-full.size-full {
    width: 100%;
    height: 100%;
}