Home › Forums › Add-ons › Flexible Content Field › Flexible Content to Releationship to Flexible Content › Reply To: Flexible Content to Releationship to Flexible Content
I didn’t have to try that way now because I solved the problem by looking through my code once again and I found the damn problem…
When I check for a relationship I used this code:
<?php $widgets = get_sub_field('widgets'); if($widgets && !get_sub_field('full_width')): ?> <?php foreach( $widgets as $post): ?> <?php setup_postdata($post); ?>
And when I then checked for the Flexible Content inside this “widget” I used this code:
<?php if( have_rows('widgets') ): ?> <?php while ( have_rows('widgets') ) : the_row(); ?>
This obviously didn’t work so I figured out that maybe the name of my flexible content “widgets” was conflicting with the relationship get_sub_field(‘widgets’). So I changed name on my Flexible Content field to “widgets_flexible” and it worked…
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!
© 2022 Advanced Custom Fields.