Show Date Once Per Day

I am trying to replicate functionality I remember using with Wordpress – specifically <?php the_date(); ?> from: Function Reference/the date « WordPress Codex

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?

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

@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!

@anon77445132: 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.

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.

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

1 Like