Home › Forums › Add-ons › Repeater Field › how get ALT of images in foreach loop?
<div class="s-project-tab section" >
<div class="container">
<?php
the_field('header_block_child');
?>
<?php
$childs_child=get_field('childs_child');
if($childs_child){
?>
<div class="tabs">
<div class="tabs__caption">
<?php
$tabs__content='';
foreach ($childs_child as $key=>$item){
?>
<div class="tabs__btn <?php if($key===0)echo 'active';?>"><?php echo $item['title']?></div>
<?php
ob_start();
?>
<div class="tabs__content <?php if($key===0)echo 'active';?>">
<div class="row">
<?php
$childs=$item['Childs'];
if($childs){
foreach ($childs as $child){
?>
<div class="tabs__col col-lg-4 col-sm-6">
<div class="tabs__item">
<a class="tabs__img-wrap img-bg" style="background-image: url(<?php echo $child['photo']?>)" >
<img class="lazy-bg" src="#" data-src="<?php echo $child['photo']?>" alt=" ??? "/>
</a>
</div>
</div>
<?php
}
}
?>
</div>
</div>
<?php
$tabs__content.=ob_get_clean();
}
?>
</div>
<div class="tabs__wrap">
<?php echo $tabs__content;?>
</div>
</div>
<?php
}
?>
<div class="tabs__foot">
<?php the_field('footer_text_child'); ?>
</div>
</div>
</div>
look this
<a class="tabs__img-wrap img-bg" style="background-image: url(<?php echo $child['photo']?>)" >
<img class="lazy-bg" src="#" data-src="<?php echo $child['photo']?>" alt=" ??? "/>
</a>
echo $child[‘photo’] this not right value? because field photo – array image.
how get url field photo (repeat in repeat) and alt this image?
The topic ‘how get ALT of images in foreach loop?’ is closed to new replies.
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.