Hello,
We are using Repeater Field to display related posts as widget in single.php. We have the following code.
<?php
$post_id = get_the_ID(); // if ACF is outside loop, use this to get post ID
$post_objects = get_field('repeater_related_items', $post_id);
if( $post_objects): ?>
<div class="widget_outer als_repated_posts">
<h2>Gerelateerd</h2>
<ul>
<?php foreach( $post_objects as $post) : // variable must be called $post (IMPORTANT) ?>
<?php setup_postdata($post); ?>
<li>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</li>
<?php endforeach;?>
</ul>
<?php wp_reset_postdata(); ?>
</div>
<?php endif;?>
The Problem is that it displays only to logged in users. Once logged out it doesn’t display.
Regard’s
We are still waiting for any reply…