Support

Account

Home Forums Add-ons Repeater Field the_repeater_field not working? Reply To: the_repeater_field not working?

  • The last part (which appears to have been truncated on previous post. It is too late to edit it now)

    <?php for ($i = 0; $i < count($uniqueYears); $i++) { ?>
                    <a href="/news/newsletter/<?php  echo str_replace(' ', '', $uniqueYears[$i]); ?>/"><?php echo $uniqueYears[$i]; ?></a>
                  <?php  } ?>

    Is pagination via year (2021 2020 2019, etc.) that link to the respective year page. Just trying to paginate by year.

    Sorry for the redundant post and edit, I noticed another truncated line in previous post as well, just going to re paste the full block below.

    <?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 href="<?php echo $data[$i]['link'] ?>" rel="bookmark"><?php  echo $data[$i]['title'] ?></a></strong>
          </li>
          <?php  } ?>
        <?php  } ?>
      </ul>
    <!-- PAGINATION LINKS -->
      <?php for ($i = 0; $i < count($uniqueYears); $i++) { ?>
        <a href="/news/newsletter/<?php  echo str_replace(' ', '', $uniqueYears[$i]); ?>/"><?php echo $uniqueYears[$i]; ?></a>
      <?php  } ?>
    </div>
    <?php  } ?>
    <?php  } ?>