Created
January 9, 2017 07:05
-
-
Save antiden/28c970e97d7c4f59ba4a938bcf193b5b to your computer and use it in GitHub Desktop.
WP ACF Relationship
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 $posts = get_field('relationship_field_name'); ?> | |
<?php if( $posts ): ?> | |
<ul> | |
<?php foreach( $posts as $post): ?> | |
<?php setup_postdata($post); ?> | |
<li> | |
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> | |
<span>Custom field from $post: <?php the_field('author'); ?></span> | |
</li> | |
<?php endforeach; ?> | |
</ul> | |
<?php wp_reset_postdata(); ?> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment