I have created some Flexible Content Fields using ACF and I have created styled section templates to display the information. Then I made another template for the flexible content using PHP and I have run into an issue.
While the Flexible content template displays the section templates with the information I have in the fields, the issue is that if I have a second instance of a flexible layout with different information, it will repeat the information I have in the first instance and not add the new unique information, which is the point of flexible content. Is there a fix for this? Have I made an error? Here is the code I am using for the template if that helps sort this out.
In your code, you are using the same shortcode for both the ‘test_heading_section’ and ‘test_image_section’ layouts, which might be causing the duplication.
Here’s an updated version of the code that should address the issue:
<?php if (have_rows('test_layouts')) : ?>
<?php while (have_rows('test_layouts')) : the_row(); ?>
In this updated code, we are using the the_field() function to retrieve the specific field values for each section template. Make sure to replace 'heading_section_content' and 'image_section_content' with the actual field names you have defined in your ACF Flexible Content Field.
Let me know, if this was helpful for you.
I am still getting the same type of result. Bricks is wrapping whatever the class and tag of the outer “loopable” element is (div, block, section, or custom), around every single repeated item inside the loop. Any work arounds so that the inside items are not individually wrapped with the tag and class of the parent looper?