Home Forums ACF PRO Front end returns different value than database


Front end returns different value than database

  • Hi, i’ve set up a radio button with 3 options. I echo the value of the radio button on the front end, but it will always return ‘internal’, while i can see in the database it’s value is ‘file’. At first I thought it had something to do with caching, but when I change other stuff they immediately appear on the front end. Below is my code:

    				<div class="flex-cta">
    					$internal_link = get_sub_field('flex-cta-link');
    					$internal_file = get_sub_field('flex-cta-file');
    					$external_link = get_sub_field('flex-cta-external-link');
    					$icon_class = get_sub_field('flex-cta-icon');
    					$link_type = get_sub_field('flex-cta-type');
    					$is_link = true;
    						if($link_type = 'internal'):
    							$cta_link = $internal_link ;
    							$open_new_window = false;
    						elseif($link_type = 'file'):
    							$cta_link = $internal_file['url'] ;
    							$open_new_window = true;
    						elseif($link_type = 'external'):
    							$cta_link = $external_link ;
    							$open_new_window = true;
    							$cta_link = '#' ;
    							$is_link = false;
    						<?php if($is_link): ?>
    							<a href="<?=$cta_link; ?>" <?php if($open_new_window): ?>target="newwindow" <?php endif; ?>class="flex-cta-button">
    								<span class="cta-text <?php echo $icon_class; ?>"><?php the_sub_field('flex-cta-text'); ?></span> <?=$link_type; ?>
    						<?php elseif($is_link == false) : ?>
    							<div class="flex-cta-button">
    								<span class="cta-text <?php echo $icon_class; ?>"><?php the_sub_field('flex-cta-text'); ?></span>
    						<?php endif; ?>
  • Offcouse… should use == insead of = in the if statement……

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

The topic ‘Front end returns different value than database’ is closed to new replies.