Pagination by years #57
-
Hello, I have pagination by pages number:
Logically, I decided that this was not convenient from the user’s point of view; it would be much more interesting to do the year instead of page numbers. Now I have list of 6 entries per page and page numbers at the bottom. <1 2 3 4 5> How to make list records sorted and displayed by each year? < 2023 2022 2021 2020 2019 > Thank you in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
My thinking is that you will probably have to do a custom component to make this happen. You could perhaps create a plugin and component that extends the You would also have to change up the component partials to accept this new format. |
Beta Was this translation helpful? Give feedback.
-
Ok, thank you. |
Beta Was this translation helpful? Give feedback.
My thinking is that you will probably have to do a custom component to make this happen.
You could perhaps create a plugin and component that extends the
\Winter\Blog\Components\Posts
component, and change up thelistPosts()
method to instead group the collection of posts by year (using thegroupBy()
method and function that returns the year of each post).You would also have to change up the component partials to accept this new format.