Support

Account

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

Solved

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')): ?>
          <ul>
            <li><h3>Name</h3><?php the_sub_field('name'); ?></li>
            <li><h3>Email</h3><?php the_sub_field('email'); ?></li>
          </ul>
        <?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.

  • Hi @Prometheus Fire

    Thanks for clarifying the solution

    Cheers
    E

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

The topic ‘Isolating repeated rows in looped data for styling’ is closed to new replies.