Created
November 30, 2016 19:10
-
-
Save amanhstu/418909a2351bfc6addc63825384c9d9f to your computer and use it in GitHub Desktop.
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
<?php $post_object = get_field('post_object'); | |
if( $post_object ): // override $post | |
$post = $post_object; | |
setup_postdata( $post ); ?> | |
<div> | |
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3> | |
<span>Post Object Custom Field: <?php the_field('field_name'); ?></span> | |
</div> | |
<?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment