0
$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 } } ?>
4

1 回答 1

1

wp_get_attachment_url只需要一个参数+你需要回显:

<?php echo wp_get_attachment_url( $attachment->ID ); ?>

注意:要获得特定的图像尺寸,请使用wp_get_attachment_image_src

于 2013-05-29T20:14:40.750 回答