Posted By

bitsculptor on 10/26/11


Tagged

wordpress related fields custom attachments advanced


Versions (?)

Using Advanced Custom Fields' Relationship Field to show attachments of a related post


 / Published in: PHP
 

  1. foreach(get_field('relationship') as $related) :
  2. $args = array(
  3. 'post_type' => 'attachment',
  4. 'numberposts' => -1,
  5. 'post_status' => null,
  6. 'post_parent' => $related->ID,
  7. );
  8. $attachments = get_posts( $args );
  9. foreach ( $attachments as $attachment ) :
  10. $headshot = wp_get_attachment_image_src($attachment->ID, "medium");
  11. echo $headshot[0];echo "<br />";
  12. endforeach;
  13. endforeach;

Report this snippet  

You need to login to post a comment.