Home › Forums › General Issues › Pulling Custom Post Data into a Loop – using it throughout the loop › Reply To: Pulling Custom Post Data into a Loop – using it throughout the loop
Hi Amber
You certainly saved me some time …
The only tweak I needed to make to your code was for one section where I allowed multiple Post Objects to be selected – using your example I added an s to – $containers and using foreach $containers as $container – to allowed me to display multiple records (prob no use for base price but if you were showing say – container colors or something you could select multiple and they would all show)
<?php $containers = get_field('container'); foreach( $containers as $container): if( $container ): ?>
<p class="price">$<?php the_field('base_price', $container); ?>+</p>
<?php endif; ?>
<?php endforeach; ?>
Thanks Again
All the best
Brad
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.