2013-12-11 91 views
0

我試圖將中繼器字段添加到靈活的內容行中,但由於某種原因沒有任何輸出。我已經檢查過這些字段,它們看起來是正確的,所以有人請指出我的錯在哪裏?由於靈活內容中的ACF中繼器字段

 <?php if(get_row_layout() == "collection_title"): // layout: Collection Title ?> 

      <div> 
       <h4><?php the_sub_field("collection_title"); ?></h4> 
      </div> 


     <?php elseif(get_row_layout() == "collection_images"): // layout: Collection Images ?> 


       <?php if(get_field('collection_images_grid')): ?> 

        <?php while(has_sub_field('collection_images_grid')): ?> 

         <div class="collections"> 

          <span><strong><?php the_sub_field('collection_detail'); ?></strong></span> 

          <a href="<?php the_sub_field('product_link'); ?>"> 

           <img src="<?php the_sub_field('collection_image'); ?>"/> 

          </a> 

         </div> 

        <?php endwhile; ?> 

       <?php endif; ?> 

     <?php endif; ?> 

    <?php endwhile; ?> 

回答

0

<?php if(get_field('collection_images_grid')): ?>的說法應該是<?php if(get_sub_field('collection_images_grid')): ?>

+1

謝謝麥克這是偉大的:) – Parariddle

0
  <?php 

      // check if the flexible content field has rows of data 
      if(have_rows('the_process')){ 

      // loop through the rows of data 
      while (have_rows('the_process')) : the_row(); 

      if(get_row_layout() == 'content'){ 

      ?> 
      <h1><?php the_sub_field('headline');?></h1> 
      <h2 class="tagLine paddingBottom80"><?php the_sub_field('sub_headline');?></h2> 

      <div class="steps clearAfter"> 

      <?php if(get_sub_field('process_steps')): ?>  
      <?php 
      while(has_sub_field('process_steps')): 
      ?> 



      <!--Step--> 
      <div class="processStep rel boxSizing"> 

      <img src="images/ph.png" width="200" height="200" class="borderRadius50Perc imageBorder boxSizing" /> 
      <div class="processBox border1 padding20 clearAfter"> 
      <div class="third processNumber boxSizing font70 darkBlue"> 
      <div class="border1 padding20"> 
      <?php echo $i;?> 
      </div> 
      </div> 
      <div class="twothird boxSizing processContent"> 
      <h3><?php the_sub_field('step_headline'); ?></h3> 
      <div class="processContentTxt grey"> 
      <?php the_sub_field('step_content'); ?> 
      </div> 
      </div> 
      </div> 
      </div> 

      <!--Step--> 
      <?php endwhile; ?> 
      <?php endif; ?>    




      </div> 


      <?php 
      } 
      endwhile; 
      } 
      ?>