Home › Forums › General Issues › Nested relationship fields won't print the_content
Relationships fields work, query_posts works but only for the title. I need the content to print, but nothing shows up. I looked at reset query and had no luck. Any ideas, appreciated…
<?php query_posts( array(
'worlds' => 'old-world',
'orderby' => 'menu_order title',
'order' => 'ASC'
)); ?>
<h1>OLD WORLD</h1>
<?php if (have_posts()): while(have_posts()):the_post();?>
<ul>
<!-- Name of Producer -->
<li> <h2><?php the_title(); ?></h2>
<?php $posts = get_field('country_producer_relationship');
if( $posts ): ?>
<ul class="item"> <?php foreach( $posts as $post): ?> <?php setup_postdata($post); ?> <li> <h4><?php the_title(); ?></h4> <?php the_field('producer_description'); ?> <?php the_content(); ?> <!-- Name of Producer -->
<?php $posts2 = get_field('producer_product_relationship'); if( $posts2 ): ?> <ul id="wine-listing" class="item"> <?php foreach( $posts2 as $post): ?> <?php setup_postdata($post); ?> <li> <a href="<?php echo the_permalink(); ?>"> <strong><?php the_title(); ?></strong> </a> <?php if( get_field('price') ): ?> <?php the_field('price'); ?> <?php endif; ?> <?php if( get_field('availability') ): ?> <?php the_field('availability'); ?> <?php endif; ?> <?php if( get_field('vintage') ): ?> <?php the_field('vintage'); ?> <?php endif; ?> </li> <?php endforeach; ?> </ul><!-- end wine-listing --> <?php wp_reset_postdata();?> <?php endif; ?><!-- end producer-wine relationship --> </li> <?php endforeach; ?> </ul> <?php wp_reset_postdata();?> <?php endif; ?><!-- end country-producer relationship -->
</li>
<?php endwhile; else: ?>
</ul>
<?php endif; wp_reset_query(); ?>
You must be logged in to reply to this topic.
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!
🚀 This week’s session of ACF Chat Fridays dips into the preliminary results of our first ever user survey. Don’t miss it! https://t.co/3UtvQbDwNm pic.twitter.com/kMwhaJTkZc
— Advanced Custom Fields (@wp_acf) May 9, 2023
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.