Support

Account

Home Forums Add-ons Repeater Field Post Object Custom Field Reply To: Post Object Custom Field

  • Hi @elmwoodplayhouse

    You could just post the code here as well within code tags tho 🙂

    Try this:

    
    <?php if( have_rows('cast') ): ?>
    
    	<?php while( have_rows('cast') ): the_row(); ?>
    
    		<?php $post_object = get_sub_field('actor'); ?>
    	    <?php if( $post_object ): ?>
    			<?php
    	        // override $post
    	        $post = $post_object;
    	        setup_postdata( $post );
    			?>
                  
    			<h1><?php the_title(); ?></h1>
    
    			<?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
    
            <?php endif; ?>
    	<?php endwhile; ?>
    
    <?php endif; ?>