Support

Account

Home Forums Add-ons Repeater Field Repeater Help

Helping

Repeater Help

  • I am using a repeater from ACF to allow easily editable content. I then display the information put into the repeater like so :

    IMG | Content

    Content | IMG

    IMG | Content

    I now no longer need an image in the second row, so i need second row of content in the repeater to show the content to be a large-12 cell. I have this code but i’m unsure of how to adapt it so it outputs like

    IMG | Content

    Content |

    IMG | Content

    Any help is massively appreciated.

      <div class="grid-x grid-margin-x grid-padding-x">
    
                        <?php $i=0 ; if(get_field( 'biography_repeater')):
                        while(has_sub_field( 'biography_repeater')): $i++;
                        $image=get_sub_field( 'biog_img');?>
                        <div class="grid-x grid-margin-x grid-padding-x">
                            <!-- right column -->
                            <div class="large-6 cell biog-card">
                                <?php if (($i % 2)==0 ): ?>
                                <h2>
                                    <?php the_sub_field( 'biog_title'); ?>
                                </h2>
                                <hr />
                                <p>
                                    <?php the_sub_field( 'biog_desc'); ?>
                                </p>
                                <?php else: ?>
    
                                <img src="<?php echo $image['url']; ?>" />
                                <?php endif; ?>
                            </div>
    
                            <div class="large-6 cell biog-card">
                                <?php if (($i % 2)==0 ): ?>
                                <img src="<?php echo $image['url']; ?>" />
                                <?php else: ?>
                                <h2 style="text-align:right;">
                                    <?php the_sub_field( 'biog_title'); ?>
                                </h2>
                                <hr />
                                <p style="text-align:right;">
    
                                    <?php the_sub_field( 'biog_desc'); ?>
                                </p>
                                <?php endif; ?>
                            </div>
                            <!-- right column -->
                        </div>
    
                        <?php endwhile; ?>
    
                        <?php endif; ?>
    
                    </div>
  • Anyone be able to help pleasE

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.