2016-07-21 9 views
0

私はネストされたリピータフィールドを持っています。ネストされたリピータフィールドACF - フィールド1のコンテンツを表示

ネストされた部分はモーダルウィンドウで、開いたときに2番目のリピータフィールドに展開されます。しかし、すべてが記入されると、モーダルウィンドウにループ内の最初の項目の情報が表示されます。

これは、それが動作する方法である。 http://pagedev.co.uk/hoppings/product-sector.php#

をここでは私のコードです:

<div class="container"> 

     <?php while(have_rows('product_sections')): the_row(); ?> 


     <div class="sector-heading"> 
      <img src="<?php the_sub_field('section_logo'); ?>"> 
      <div><?php the_sub_field('section_intro'); ?></div> 
     </div> 


      <?php if(have_rows('products')): ?> 


       <div class="grid-wrapper"> 


        <?php while(have_rows('products')): the_row(); ?> 


         <!--Start Single Product--> 
         <div class="grid-item"> 

          <div class="image-hovers"> 
           <img src="<?php the_sub_field('thumbnail'); ?>"> 
           <a class="js-open-modal" href="#" data-modal-id="popup"><div class="product-hover"></div></a> 
          </div> 

          <div class="grid-title"> 
           <h2><?php the_sub_field('product_name'); ?></h2> 
          </div> 

         </div> 


           <!--Start Single Product Modal--> 
           <div id="popup" class="modal-box"> 

            <a href="#" class="js-modal-close close">×</a> 

            <div class="modal-wrap"> 

             <div class="modal-img"> 
              <img src="<?php the_sub_field('thumbnail'); ?>"> 
             </div> 

             <div class="modal-content"> 
              <h2><?php the_sub_field('product_name'); ?></h2> 
              <p><strong><?php the_sub_field('product_size'); ?></strong></p> 
              <hr> 
              <?php the_sub_field('product_description'); ?> 
              <a href="<?php the_sub_field('product_description'); ?>"><div class="modal-stockist">Find a Stockist</div></a> 
              <a href="<?php the_sub_field('literature_link'); ?>"><div class="modal-literature">Literature</div></a> 
             </div> 

            </div> 

           </div> 
           <!--Close Single Product Modal--> 



         <?php endwhile; // end of the loop. ?> 

       </div> 
       <!--End Grid Wrapper--> 

      <?php endif; ?> 
      <!-- Close product repeater field --> 


     <?php endwhile; // end of the loop. ?> 


    </div> 
    <!--End Container--> 

すべてのヘルプは素晴らしいことです!

リー

答えて

0

私はそれを理解しました。何かとても簡単!

私のモーダルウィンドウには、製品ごとに固有のIDが必要でした。

すべて解決しました:)

関連する問題