1

I have an agenda on my homepage, and I want to always ensure 5 events.

If there are 5 or more following events (including the current one), show the nearest 5 from the start date.

If there is less, show X past events in such a way that the following and the past are 5 in total.

Examples:

Today is March 12.

a) List of events (more than 5 futures): - March 10th - March 11th - March 12 - March 13 - March 14 - March, 15th - March 16 - March 17 - March 18th

Show in the view March 12, 13, 14, 15 and 16.

b) List of events (mix, p past events, q future events): - March 9 - March 10th - March 11th - March 13 - March 14 - March, 15th

Show in the view: March 10, 11, 13, 14 and 15.

c) List of events (no future events, show recent events). - March 1st - March 2 - March 3rd - March 8 - March 9 - March 10th - March 11th

Show in the view: March 3, 8, 9, 10 and 11.

0

You will need to develop a custom module with a custom views sort plugin as views don't have something for this.

Read the Custom Views Sort Plugin for Upcoming Events blog post that will help you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.