Support

Account

Home Forums General Issues Group-field multiple choice button – behavior Reply To: Group-field multiple choice button – behavior

  • In this case I would check for the value of the field that sets the condition for the field you want to display. That way even if there is a previous value saved in the database, the one you’d like to be currently displayed will still show up.

    <article class="card">
    	<?php
    	// Variables.
    	$card = get_field( 'card' );
    	$button_type = get_field( 'card' )['button-type'];
    	?>
    
    	<?php if ( $button_type == 'file' ) { ?>
    
    		<a class="button" href="<?php echo $card['button-file']['url']; ?>"><?php echo $card['button-text']; ?></a>
    
    	<?php } elseif ( $button_type == 'email' ) { ?>
    
    		<a class="button" href="mailto:<?php echo $card['button-mail']; ?>"><?php echo $card['button-text']; ?></a>
    
    	<?php } else { ?>
    
    		<a class="button" href="<?php echo $card['button-url']; ?>"><?php echo $card['button-text']; ?></a>
    
    	<?php } ?>
    </article>