Answer the question
In order to leave comments, you need to log in
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>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question