Query loop in reverse order.
-
I have a Timeline on a page like this one: https://codepen.io/NilsWe/full/FemfK/
When I go to edit the page, each new entry in the loop has to be dragged to the top of the list, because when I add a new entry it automatically adds it to the bottom.
Therefore, on the page where the item is displayed, I want it to appear in reverse order.
My code is:
<?php $timelinefields = CFS()->get('timeline-fields'); ?> <div class="timeline group"> <div class="timeline-title"> <div class="timeline-text"> <?php echo CFS()->get('timeline-title'); ?> </div> </div> <? foreach ($timelinefields as $timelinefield) : ?> <div class="<?=($c++%2==1)?"item-even":"item-odd"?> item"> <span class="role-field"><?= $timelinefield['timeline-role'] ?></span> <p> <span class="location-field"><?= $timelinefield['timeline-location'] ?></span> <span class="time-field"><?= $timelinefield['timeline-date'] ?></span><br /> <span class="description-field"><?= $timelinefield['timeline-experience-activities'] ?></span> </p> </div> <? endforeach ?>
Thanks
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Query loop in reverse order.’ is closed to new replies.