WordPress.org

Ready to get started?Download WordPress

Forums

Advanced Custom Fields
How to adding a repeater field in a repeater field (1 post)

  1. rikardo85
    Member
    Posted 1 year ago #

    Hello,

    have set up a repeater custom field, inside this I would like to add another repeater field.

    The current code I am using is

    <?php
    
    			$rows = get_field('membership_option');
    			if($rows)
    			{
    			foreach($rows as $row)
    			 { ?>
    			 <div class="item">
    
    			<div class="itemLeft">
    			 <h2><?php echo $row['membershipName']; ?></h2>
    			 <p><?php echo $row['description']; ?></p>
    			</div><!-- itemLeft-->
    
    			<div class="itemCenter">
    /* 2nd REPEATER FIELD HERE ------------------------- */
    
    			<?php if(get_field('benefitsList')): ?>
    			<ul>
    			  <?php while(has_sub_field('benefits')): ?>
    			   <li>sub_field_1 = <?php the_field('benefits'); ?></li>
    			  <?php endwhile; ?>
    			</ul>
    			<?php endif; ?>
    
    /* END 2ND REPEATER FIELD ------------------------------------ */
    
    			</div><!-- itemCenter -->
    
    			 <div class="itemRight">
    			  <table class="prices">
    			   <tr>
    				<td></td>
    				<td>Direct Debit*</td>
    				<td>Monthly</td>
    				<td>Annual</td>
    			   </tr>
    			   <tr>
    				<td>Adult</td>
    				<td><?php echo $row['adultDDprice']; ?></td>
    				<td><?php echo $row['adultMonthlyPrice']; ?></td>
    				<td><?php echo $row['adultAnnualPrice']; ?></td>
    			   </tr>
    			   <tr>
    				<td>Senior (60+) /<br/> Student</td>
    				<td><?php echo $row['senStuDDprice']; ?></td>
    				<td><?php echo $row['senStuMonthlyPrice']; ?></td>
    				<td><?php echo $row['senStuAnnualPrice']; ?></td>
    			   </tr>
    
    			  </table>
    
    			 </div><!-- itemRight-->
    
    			 </div><!--item-->
    			<?php
    			 } //end for
    			}// endif ?>

    I am wanting to add the 2nd repeater field just after the itemCenter div.

    Any help much appreciated.

    Thanks

    http://wordpress.org/extend/plugins/advanced-custom-fields/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic