Skip to content

Instantly share code, notes, and snippets.

@bratsun
Created January 29, 2016 14:10
Show Gist options
  • Save bratsun/8449b55c9e10fcd3b48a to your computer and use it in GitHub Desktop.
Save bratsun/8449b55c9e10fcd3b48a to your computer and use it in GitHub Desktop.
Loop through post objects
<?php
$post_objects = get_field('post_objects');
if( $post_objects ): ?>
<ul>
<?php foreach( $post_objects as $post_object): ?>
<li>
<a href="<?php echo get_permalink($post_object->ID); ?>"><?php echo get_the_title($post_object->ID); ?></a>
<span>Post Object Custom Field: <?php the_field('field_name', $post_object->ID); ?></span>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment