Is it possible to group blog pages by relative date? #959
Answered
by
pftnhr
pftnhr
asked this question in
Ask a question
-
I like how the relative date looks in the There, however, I group the posts by day and output the date with I am now looking for a simple work-around to display the relative date in the |
Beta Was this translation helpful? Give feedback.
Answered by
pftnhr
Jan 26, 2025
Replies: 0 comments 1 reply
-
Here's the solution: Create a variable from the group <?php foreach ($collectionMonth->group("published", false, "Y-m-d") as $day=>$collectionDay):
$relDay = $collectionDay[0]->getDateRelative("published");
?> Then you can output it at your desired position within the group: <time class="dt-published published postdate" datetime="<?php echo date(DATE_ISO8601, strtotime($day)) ?>">
<?php echo $relDay ?>
</time> |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
pftnhr
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's the solution:
Create a variable from the group
Then you can output it at your desired position within the group: