Support

Account

Home Forums Add-ons Repeater Field Check if there is 2 same subfield

Unread

Check if there is 2 same subfield

  • Hello ! That’s me again !

    I have an issue with the repeater field. I would like to check if there is repeater field that are similar, and if they are, do something with the value that they return, in order to not repeat the same field !

    Something like this :

    <?php if( have_rows('event') ): while ( have_rows('event') ) : the_row(); ?>
    <?php $place_event_1 = get_sub_field('place_event_1');?>	
    <?php $place_event_2 = get_sub_field('place_event_2');?>	
    <?php if ($place_event_1 == $place_event_2) {echo "Same value ";} else {echo "Different value ";}?>
    <?php endwhile; ?>
    <?php else : ?>		
    <?php endif; ?> 

    I don’t know if it’s very clear !

    Thanks

Viewing 1 post (of 1 total)

The topic ‘Check if there is 2 same subfield’ is closed to new replies.