Home › Forums › Add-ons › Repeater Field › the_repeater_field not working? › Reply To: the_repeater_field not working?
Yes, correct. OK, well, I am using this instance in two places, but one place doesn’t have a huge list so I think for that one I will just show all and not paginate to simplify this problem a bit more. If I change the above to
<?php if(get_field('media')) { ?>
<div class="info news">
<ul>
<?php $counter = 0; ?>
<?php while ( have_rows('media') ) : the_row(); ?>
<?php
$data[$counter]['date'] = get_sub_field('date');
$data[$counter]['file'] = get_sub_field('file');
$data[$counter]['title'] = get_sub_field('title');
$counter++;
?>
<?php endwhile; ?>
<?php for($i = 0; $i < count($data); $i++) { ?>
<li>
<em><?php echo $data[$i]['date'] ?></em>
<strong><a href="<?php echo $data[$i]['file'] ?>" rel="bookmark"><?php echo $data[$i]['title'] ?></a></strong>
</li>
<?php } ?>
</ul>
</div>
That works fine, however I would like to reverse the sort so the most current date is at the top of the list and not the bottom. Do you know how I might change this to do that? Thanks for your help.
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!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.