显示附加图像在Wordpress上发布

时间:2009-11-29 10:12:14

标签: wordpress loops attachment

如何在Wordpress上显示帖子的附加图像?

2 个答案:

答案 0 :(得分:14)

在single.php模板中试试这个:

$args = array(
'post_type' => 'attachment',
'post_mime_type' => 'image',
'post_parent' => $post->ID
);
$images = get_posts( $args );
foreach($images as $image):
echo wp_get_attachment_image($image->ID, 'medium');
endforeach;

答案 1 :(得分:1)