Home › Forums › Front-end Issues › Extracting Post Object data from within a Repeater › Reply To: Extracting Post Object data from within a Repeater
Hey Jonathan –
I gave that a shot but it isn’t working, and I think it’s because I am trying to access this data from within a foreach loop, like so:
<div class="news-container">
<?php $news = get_field('ssm_featured_content'); ?>
<?php foreach ($news as $item) { ?>
<?php $postObject = get_sub_field('ssm_featured_page'); ?>
<?php echo $postObject->$post_title; ?>
<?php } ?>
</div>
<!-- end .news-container -->
I tried to adjust as follows, but I am not sure how the code should look:
<?php echo $item[$postObject->$post_title]; ?>
but that didn’t seem to be correct either. I’m just not sure how to handle this.
Rich
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.