【发布时间】:2013-07-23 05:34:47
【问题描述】:
我在页面上有一个图片库,我正在使用高级自定义字段来提取该图片的缩略图和更大版本。现在,我将它设置为两个单独的字段,因此用户必须上传两个单独的图像(缩略图和完整尺寸)。我正在尝试进行设置,因此用户只需上传一张图片,但是当我按照http://www.advancedcustomfields.com/resources/field-types/image/ 上的示例进行操作时,我的缩略图不起作用,但完整的图片仍然有效。这是我一直在使用的代码:
<?php query_posts(array(
'post_type' => 'gallery_images',
'posts_per_page' => 20,
)); ?>
<?php while (have_posts()) : the_post(); $gallery_images;
$attachment_id = get_field('gallery_full');
$size = "thumbnail"; // (thumbnail, medium, large, full or custom size)
$image = wp_get_attachment_image_src( $attachment_id, $size );
?>
<div class="gallery_image_wrap"><a rel="shadowbox[galpage]" href="<?php the_field('gallery_full'); ?>"><img src="<?php echo $image[0]; ?>" /></a></div>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
这是它返回的示例:
<div class="gallery_image_wrap">
<a href="http://example.com/photo.jpg" rel="shadowbox[galpage]">
<img src=" ">
</a>
</div>
我做错了什么? (另外,我尝试上传一张新图片,看看是否有解决方案,但我仍然遇到了同样的问题。)
【问题讨论】:
标签: image wordpress thumbnails custom-fields options-menu