C
C
Chokatillo2017-02-25 17:21:04
Algorithms
Chokatillo, 2017-02-25 17:21:04

How to show the current date of groups of posts when scrolling (while hiding other dates)?

On the page with infinite loading of posts, the dates are displayed in the following way:

<div class="boxcontainer">
  <?php $ym_ = "";
if ( have_posts() ) :
  while ( have_posts() ) : the_post();
    $ym = get_the_date('Ym', $post->ID);
    if ( $ym_ != $ym ){
      echo '<div class="data">'.get_the_date('F Y', $post->ID).'</div>';}
    get_template_part('pinbox', get_post_format());
    $ym_ = $ym;
  endwhile;
       endif; ?>
    </div>

But the dates are displayed all (loaded posts), and I need only the date of the current group of posts to be displayed on the Current screen, I mean the group of posts visible on the screen that appear when scrolling.
In general, it is necessary that the desired date be visible, and not necessary were hidden. Does
anyone have any ideas?
Thank you!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question