$argsThumb = array(
'order' => 'ASC',
'post_type' => 'attachment',
'post_parent' => $post->ID,
'post_mime_type' => 'image',
'post_status' => null
);
$attachments = get_posts($argsThumb);
if ($attachments) {
foreach ($attachments as $attachment) { ?>
<div class="item">
<a href="<?php wp_get_attachment_url($attachment->ID, 'large', false, false); ?>" class="zoom" rel="group">
<span class="thumb">
<img class="small" src="<?php wp_get_attachment_url($attachment->ID, 'medium', false, false); ?>" />
</span>
</a>
</div>
<?php } } ?>
答案 0 :(得分:1)
wp_get_attachment_url
只需要一个参数+你需要回应:
<?php echo wp_get_attachment_url( $attachment->ID ); ?>
注意:要获取特定图片尺寸,请使用wp_get_attachment_image_src