Home › Forums › General Issues › setup_postdata inside anothe setup_postdata › Reply To: setup_postdata inside anothe setup_postdata
Finally, I resolved it like this, on the second query inside the loop
<?php $negatives = get_field( "collections_single_work"); ?>
<?php if( $negatives ): ?>
<?php foreach( $negatives as $post ): ?>
<?php setup_postdata($post); ?>
here goes some coding
<?php $related_posts = get_field('collection_edition_size');
if ($related_posts) {
foreach ($related_posts as $related_post) {
?>
<?php if( get_field('size_of_the_negative', $related_post->ID) == '4x5'): ?>
here goes some coding
<?php
}
} ?>
here goes some coding which is part of the first loop
<?php wp_reset_postdata(); endforeach; ?>
<?php endif; ?>
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.