Skip to content

Instantly share code, notes, and snippets.

@wpflames
Last active April 24, 2022 11:47
Show Gist options
  • Select an option

  • Save wpflames/caec84ad78896229c7dbe9e5b7865086 to your computer and use it in GitHub Desktop.

Select an option

Save wpflames/caec84ad78896229c7dbe9e5b7865086 to your computer and use it in GitHub Desktop.
ACF Post Object
<?php if( have_rows('repeater') ): ?>
<?php while ( have_rows('repeater') ) : the_row(); ?>
<?php $post_object = get_sub_field('post_object'); ?>
<?php if( $post_object ): ?>
<?php $post = $post_object; setup_postdata( $post );
// Variables
$title = get_the_title( $post_object->ID);
$link = get_field('link', $post_object->ID);
$image = get_field('image', $post_object->ID); ?>
<h4><?= $title ?></h4>
<?php wp_reset_postdata(); ?>
<?php endif; ?>
<?php endwhile; ?>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment