How do you get all the urls of images attached to a post?

Question

I’ve searched high and low and can’t seem to get it.

I’m trying to output an XML feed with all the images attached to a post from a custom post type:

</BasicDetails>
<Pictures>
 <Picture>
  <PictureUrl><?php echo wp_get_attachment_url( get_post_thumbnail_id($post->ID)); ?></PictureUrl>
 <Caption></Caption>
 </Picture><Picture>
 <PictureUrl></PictureUrl>
 <Caption></Caption>
</Picture>
</Pictures>

I’m using wp_get_attachment_url but it’s only returning one image (There’s more than one per post)

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

The <Picture> is a repeating element so it should start an new tree when there’s another image attached.

Any help would be Amazing!

0
, , Marco 9 years 2015-03-01T14:57:25-05:00 0 Answers 79 views 0

Leave an answer

Browse
Browse