Home Forums Add-ons Repeater Field Isolating repeated rows in looped data for styling


Isolating repeated rows in looped data for styling

  • My next issue is about getting individual datasets that are repeated using a repeater loop isolated in divs or other html tags so that individual sets can be styled.

    For example, in this case I am using people. When an editor adds multiple people to a repeater field the data is getting returned properly, but I seem to be having trouble getting the individual people-related datasets isolated properly to apply CSS.

    Note the ul tags. I had no problem when I added a class to the li tags, and I was able to style the individual fields, but adding a class to the ul tag doesn’t do anything. I’m trying to get so I can visually separate each repeated dataset, but I can’t seem to get any CSS applied to each isolated ul section.

    What am I doing wrong?

    <?php if(get_field('user_emails')): ?> 
      <div class="section-head"><h2>User Email List</h2></div>
        <?php while(has_sub_field('user_emails')): ?>
            <li><h3>Name</h3><?php the_sub_field('name'); ?></li>
            <li><h3>Email</h3><?php the_sub_field('email'); ?></li>
        <?php endwhile; ?>
    <?php endif; ?>
  • After doing some searching, I’m not any closer, but have read a lot about adding divs around each set of a php loop. However, I’m still struggling to make it work.

  • This is my fault and is entirely a CSS issue. I was float:left on the internal li elements and that caused the issue. Not and ACF concern.

    Marking this resolved, and you can delete this thread when you get a chance.

    • Elliot

    • September 11, 2013 at 2:14 pm

    Hi @prometheus Fire

    Thanks for clarifying the solution


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

You must be logged in to reply to this topic.

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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.