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!
📣 “ACF Chat Fridays”
— Advanced Custom Fields (@wp_acf) January 31, 2023
The ACF team holds their first open office hours this Friday! Come and talk ACF, and ask questions about building sites with the plugin.
We’d love to see you there!
📆 Friday 3rd Feb - 3pm UTC
👉 Register here - https://t.co/3UtvQbE4CU pic.twitter.com/oTwW9K1XQ0
© 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.