Home › Forums › Add-ons › Repeater Field › Nested repeater fields and conditional statements › Reply To: Nested repeater fields and conditional statements
Hi @eolis
You need to modify it a little bit to make it like that. Something like this:
$productURLsRow = get_field('product_urls');
print_r($productURLsRow);
foreach($productURLsRow as $productURLs){
foreach($productURLs as $key => $productURL){
if(!empty($productURL)){
if($key == 'product_urls_us'){
$URLflag = 'us';
} elseif ($key == 'product_urls_ca'){
$URLflag = 'ca';
} elseif ($key == 'product_urls_eu'){
$URLflag = 'eu';
} elseif ($key == 'product_urls_uk'){
$URLflag = 'uk';
} elseif ($key == 'product_urls_au'){
$URLflag = 'au';
} elseif ($key == 'product_urls_jp'){
$URLflag = 'jp';
}
foreach($productURL as $shopURL){
echo $URLflag . ' <a href="'. $shopURL["product_url"] .'">'. $shopURL["webshop_name"] .'</a>';
}
}
}
}
Please learn more about Array and foreach function.
I hope this helps.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.