Support

Account

Home Forums Add-ons Repeater Field Display repeater field base on radio button selected Reply To: Display repeater field base on radio button selected

  • I think you would want to do something like this:

    <?php if( have_rows('workshops') ): ?>
    
       <?php while ( have_rows('workshops') ) : the_row();
       
    		// assigns checkbox value to var
    		$location = get_sub_field('checkbox'); ?>
    
    		<div id="boston">
    			<?php if ( $location == 'boston' || $location == 'both' ): ?>
    				// boston information
    				<?php get_sub_field('title'); ?>
    				<?php get_sub_field('link') ?>
    			<?php endif ?>
    		</div>
    
    		<div id="newton">
    			<?php if ( $location == 'newton' || $location == 'both' ): ?>
    				// newton information		
    				<?php get_sub_field('title'); ?>
    				<?php get_sub_field('link') ?>
    			<?php endif ?>
    		</div>
    
    	<?php endwhile; ?>
    
    <?php endif; ?>

    Also you probably want your radio button choices to be flipped:

    boston : Boston
    newton : Newton
    both : Both