Created
April 8, 2012 15:48
-
-
Save cphilippsen/2338078 to your computer and use it in GitHub Desktop.
ACF Relationship get related posts fields content
This file contains 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
<?php if(get_field('relationship')): ?> | |
<h2>Related posts</h2> | |
<ul id="portfolio-grid"> | |
<?php foreach(get_field('relationship') as $related): ?> | |
<li> | |
<a href="<?php echo get_permalink($related->ID); ?>" title="<?php echo get_the_title($related->ID) ?>"> | |
<img src="<?php the_field('image_src', $related->ID); ?>" alt="" /> <span class="caption"><?php the_field('image_caption', $related->ID); ?></span> | |
</a> | |
</li> | |
<?php endforeach; ?> | |
</ul> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment