Support

Account

Home Forums Add-ons Repeater Field Repeater field with IF/ELSE based on sub_field value Reply To: Repeater field with IF/ELSE based on sub_field value

  • I’ve checked the template files, one has a loop for a flexible content field. So, for case studies (basic blog post/category, not CPT) I have flexible content fields. I loop through just one of them (in the template include) and break after the first ‘paragraph’ content field… just to get the content for that case study.

    If I remove that flexible content loop from the include.. the page LOADS but with only the first row of the repeater! IF I use get_posts instead of WP query, it loads all of the rows…

    Here is the flexible content loop from the case-studies.php file:

    			<?php if (have_rows('flexible_content_types')): ?>
    				<?php while (have_rows('flexible_content_types')): the_row(); ?>
    					<?php if (get_row_layout() == 'paragraph_content'): ?>
    						<?php // get the FIRST paragraph content only, truncate it ?>
    						<p class="mb-3"><?php echo truncate(get_sub_field('content'), 180); ?></p>
    						<?php break; ?>
    					<?php endif; ?>
    				<?php endwhile; ?>
    			<?php  endif; ?>