Home › Forums › Add-ons › Repeater Field › the_repeater_field not working? › Reply To: the_repeater_field not working?
Ok, I changed it to this, didn’t break anything, but the pagination is still an issue, what am I missing here? This was working on WP 5.4 but 5.5 and beyond it is not.
<?php if(get_field('newsletter')) { ?>
<div>
<h3>Newsletter</h3>
<ul>
<?php $urlSplits = explode('/', $_SERVER['REQUEST_URI']); ?>
<?php $counter = 0; ?>
<?php
while ( have_rows('external-links') ) : the_row();
$tempDate = explode(',', get_sub_field('date'));
$mediaYears[] = $tempDate['1'];
$data[$counter]['year'] = $tempDate['1'];
$data[$counter]['date'] = get_sub_field('date');
$data[$counter]['link'] = get_sub_field('link');
$data[$counter]['title'] = get_sub_field('title');
$counter++;
endwhile;
?>
<?php
$keys = 0;
$mediaYears = array_unique($mediaYears);
foreach ($mediaYears as $value) {
if ($value != '') {
$uniqueYears[$keys] = $value;
$keys++;
}
}
rsort($uniqueYears);
$data = array_reverse($data, true);
if ($urlSplits[3] != '') {
$currentYear = str_replace(' ', '', $urlSplits[3]);
} else {
$currentYear = str_replace(' ', '', $uniqueYears[0]);
}
?>
<?php for($i = count($data); $i >= 0; $i--) { ?>
<?php if ($currentYear == $data[$i]['year']) {?>
<li>
<em><?php echo $data[$i]['date'] ?></em>
<strong><a>" rel="bookmark"><?php echo $data[$i]['title'] ?></a></strong>
</li>
<?php } ?>
<?php } ?>
</ul>
<?php for ($i = 0; $i < count($uniqueYears); $i++) { ?>
<a>"><?php echo $uniqueYears[$i]; ?></a>
<?php } ?>
</div>
<?php } ?>
<?php } ?>
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.