The following loop works great for me in getting posts with a given date with the use of the_time(…):
<?php
$myPost = new WP_Query( array(
'posts_per_page' => '50',
'orderby' => 'modified',
'order' => 'DESC'
));
while ($myPost->have_posts()): $myPost->the_post();
?>
<div class="timeline-group">
<p class="modified-time"><?php the_time('F j, Y') ?></p>
<h5><a href="https://wordpress.stackexchange.com/questions/274206/<?php the_permalink();?>"><?php the_title();?></a></h5>
</div>
<?php
endwhile;
//Reset Post Data
wp_reset_postdata();
?>
But the first 10 posts always show the same date (i.e. July 21, 2017). I want to display that date only once for these 10 posts. And if I create a new post tomorrow, then it should then show a new date under these 10 posts, and then the post associating to that new date. How can I transform my loop to think that way without hard-coding dates?
Thanks