dimanche 1 mars 2015

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


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 custom post type:



<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:



<?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!





Aucun commentaire:

Enregistrer un commentaire