Support

Account

Home Forums Add-ons Repeater Field Repeater Select Con State Multiple Values?

Helping

Repeater Select Con State Multiple Values?

  • I have a select field within a repeater field and am trying to do conditional logic to show what has been chosen from that particular repeater row, in this case an image size of small, medium & large.

    The var_dump( $size ); spits out the right name chosen admin end, but when i try and pass that through to a conditional nothing happens?

    <?php if( have_rows('project_image') ): ?>
    			
    				
    			
    				<?php while( have_rows('project_image') ): the_row(); 
    		
    						$image = get_sub_field('image');
    						$size = get_sub_field('image_size');
    						
    						
    				 ?>
    				
    				<div class="test">
    				
    					
    					<?php echo '<pre>';
    						var_dump( $size );
    					echo '</pre>'; ?>
    					
    				
    					
    					<?php
    					if( get_sub_field($size) == "large"):  
    					    echo 'Large Stuff';
    					    
    					elseif( get_sub_field($size) == "medium"):  
    					    echo 'Medium Stuff';
    					    
    					elseif( get_sub_field($size) == "small"): 
    					
    					    echo 'Small Stuff';
    					    
    					endif;
    					?>
    					
    				
    				</div>	
    				
    				
    					
    				<?php endwhile; ?>
    			
    				
    			
    		<?php endif; ?>
  • This
    if( get_sub_field($size) == "large"):
    Should either be
    if($size == "large"):
    or
    if(get_sub_field('image_size') == "large")

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

The topic ‘Repeater Select Con State Multiple Values?’ is closed to new replies.