Support

Account

Home Forums Add-ons Repeater Field Problem with getting value from repeater sub field in conditional Reply To: Problem with getting value from repeater sub field in conditional

  • I ended up getting this figured out.The fix that worked was having two if statements rather than an if/else statement. I used a simple variable to help with getting the template i needed.

    <?php
    $banners = get_field('new_banner');
    $uri = $_SERVER['REQUEST_URI'];
    $host = $_SERVER['SERVER_NAME'];
    ?>
    
    <?php 
    
    $match = 0;
    
      foreach($banners as $banner){
      	$banner_match = $banner['full_value'];
    
     	if($uri === $banner_match){
    
    		get_template_part('templates/frontpage', 'masthead-alt');
    			$match = 1;
     		}
     	}
     	if($match !== 1) {
    
    		get_template_part('templates/frontpage', 'masthead');
       		}
        
     ?>