Home › Forums › ACF PRO › Repeater Field Wrapper, Incrementing Class and IDs › Reply To: Repeater Field Wrapper, Incrementing Class and IDs
I’ve been struggling also. I can’t get the wrap properties to do anything. If you figured this out, please let me know here. I can get the repeater subfields to work and I can put a div around the repeater in the PHP of the custom post type file I’m using:
First, I have ACF installed and other fields are working. Repeaters are set up with Field Label and Field Name that ACF inserts by default, Field Name has no spaces, uses underscores between words (and I think hyphens are allowed, too.)
In my instance, I only am using one sub-field per repeater and it’s field type is set to “text”.
Here is my PHP used in the template file. You can see where I stop PHP to insert div tags with HTML, then restart PHP:
<!-- education listings -->
<?php
// check if the repeater field has rows of data
if( have_rows('education_listings') ):
// loop through the rows of data
?>
<div class="educationBlock"><h2>Education</h2>
<?php while ( have_rows('education_listings') ) : the_row(); ?>
<div class="educationListing">
<?php
// display a sub field value
the_sub_field('education_list_item');
?>
</div>
<?php
endwhile; ?>
</div>
<?php
else :
// no rows found
endif;
?>
<!-- end education listings -->
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.