Support

Account

Home Forums Add-ons Repeater Field how get ALT of images in foreach loop?

Solved

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?

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

The topic ‘how get ALT of images in foreach loop?’ is closed to new replies.