Home › Forums › Add-ons › Repeater Field › Apply different class to first two rows and last two rows › Reply To: Apply different class to first two rows and last two rows
Well, that’s because I put an error in there that I’m just now seeing, which will make it never work, sorry, and sorry for taking so long to get back to this. The $i++
is in the wrong place.
<div class="row process-content">
<?php
$i = 0;
$count = count(get_field('processes')); // has total count of rows
while (have_rows('processes')) {
$i++;
the_row();
if ($i<=2) { ?>
<div class="left-side">
<div class="item" data-item="<?php the_sub_field('step_number'); ?>">
<h5><?php the_sub_field('step_title'); ?></h5>
<p><?php the_sub_field('step_description'); ?></p>
</div> <!-- END .item -->
</div> <!-- END .left-side -->
<?php } else { ?>
<div class="right-side">
<div class="item" data-item="<?php the_sub_field('step_number'); ?>">
<h5><?php the_sub_field('step_title'); ?></h5>
<p><?php the_sub_field('step_description'); ?></p>
</div> <!-- END .item -->
</div> <!-- END .right-side -->
<?php } ?>
<?php } ?>
<div class="image-part"></div>
</div> <!-- END .process-content -->
Is anything being displayed at all?
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!
🤔 Curious about the ACF user experience? So are we! Help guide the evolution of ACF by taking part in our first ever Annual Survey and guarantee you’re represented in the results. https://t.co/0cgr9ZFOJ5
— Advanced Custom Fields (@wp_acf) May 8, 2023
© 2023 Advanced Custom Fields.
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.