I have a code like:
<?php $loop = some array with posts;
while ( $loop->have_posts() ) : $loop->the_post(); ?>
<div class="class">
<p>(data)</p>
</div>
<?php endwhile; ?>
Now I want to change the div class (from "class" to "class2") for the very last loop. How to do that?
Example:
When "some array with posts" have now 4 records then I'm getting:
<div class="class"><p>data</p></div>
<div class="class"><p>data</p></div>
<div class="class"><p>data</p></div>
<div class="class"><p>data</p></div>
And I want to get:
<div class="class"><p>data</p></div>
<div class="class"><p>data</p></div>
<div class="class"><p>data</p></div>
<div class="class2"><p>data</p></div> <!-- this one is different -->
I'm looking for something that will work always no matter how many array elements there will be.
Tanks!