Show Date Once Per Day


#1

I am trying to replicate functionality I remember using with Wordpress – specifically <?php the_date(); ?> from: https://codex.wordpress.org/Function_Reference/the_date

Here is the snippet from Wordpress’ codex:

When there are multiple posts on a page published under the SAME DAY, the_date() only displays the date for the first post (that is, the first instance of the_date()).

Is it possible to do this in Kirby?


groupBy dates in descending order
#2

You could use groupBy() or write your own function.


#3

@jony:

You may want to look at http://getkirby-plugins.com/blogprint for “Archive” pages. They are grouped by year. You can change this to day, if you want or need.

Good luck!


#4

@HeinerEF: There’s no need to do it that way anymore, the plugin you refer to is 2 years old. As I already mentioned above, we have the groupBy() method now.


#5

I’ll try it out after the site launches as its not blocking functionality, but the current loop is becoming an unwieldily beast, which makes me scared to do something with groupBy() at the moment. Thanks again! This forum has been insanely helpful with the move to Kirby.


#6

@jony. You are welcome :slight_smile:. Don’t hesitate to ask or post your code, so we can help to work it out.