Created
February 13, 2014 21:42
-
-
Save codescribblr/8984470 to your computer and use it in GitHub Desktop.
Using Advanced Custom Fields\' Relationship Field to show attachments of a related post
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| foreach(get_field('relationship') as $related) : | |
| $args = array( | |
| 'post_type' => 'attachment', | |
| 'numberposts' => -1, | |
| 'post_status' => null, | |
| 'post_parent' => $related->ID, | |
| ); | |
| $attachments = get_posts( $args ); | |
| foreach ( $attachments as $attachment ) : | |
| $headshot = wp_get_attachment_image_src($attachment->ID, "medium"); | |
| echo $headshot[0];echo "<br />"; | |
| endforeach; | |
| endforeach; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment