Limit paginated entries to summer months
I have a website for a club that's only active during the summer, from June until September. They have an events calendar page and each month needs to be a separate page with a list of events in that month.
Once the events page is opened it should show the month with the first upcoming event. The current solution I have starts at the current time so because it's now april it takes 2 extra clicks to show a month with any event.
Is it somehow possible to limit the pages to always show and paginate through the active summer months in the current year? I know that the date_from and date_to parameters should probably be used for it but I can't figure out how to paginate months with the previous and next date loops. I'm currently using {segment_2} as a variable inside the date parameter
Replies
Low 15 Apr 2015 20:56
If I understand you correctly, this will require significant customization. Not sure if LE can do that out of the box.
Here's how I'd approach it:
- The main Events page would always display Upcoming events, regardless of month.
- Then, you can have a per-month selection of events, where you could limit the selection of months to the active summer months. You could hard-code the 4 links for that.
Pagination happens on an entry level. So, if limit is set to 10, the Upcoming events will be shown in pages of 10 events per page, until there are no upcoming events left. If limit is set to 10 for per month viewing, the same will apply, but only for events within that given month.
Note that, you could use the exact same tag for all of this:
Having no segment_2 will default to today and show upcoming events.
Having segment_2 as 2015-06 will show events for June 2015, automatically limited to the month.
Dovla 15 Apr 2015 21:24
thanks for the quick reply, I just realized that having classic paging is a waste of space seeing as how only 4 months in the season are active. So I removed the next and previous links and hard coded them like you suggested:
I put them above the calendar and it works much better...I can also handle the year change and won't have to make any changes in the future
As for the initial page without the segment_2...I did something really messy:
I didn't expect that a conditional inside a parameter would work but it seems to be working fine :)