Problem:
Posts have start and end dates.
Client wants a custom search View to be able to specify start and end dates as a between filter so that if there is any overlap between the range of start-date to end-date of the posts and the filtered date range then posts should match and be displayed.
Solution:
You need to compare the end date of your filter with the start date of your post and the start date of your filter with the end date of the post.
So a partial overlap of the posts and the filters being applied would be achieved if
- the post end date is later than the filter start date (the post hasn't already finished when our filter period starts), and
- the post start date is earlier than the filter end date (the post doesn't begin after our filter period is over)
Insert the start and end filters as normal, then edit them to swap over the URL parameters that provide the filter value.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | - |
- | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | - |
Supporter timezone: Europe/London (GMT+00:00)
Ce sujet contient 2 réponses, a 2 voix.
Dernière mise à jour par Il y a 5 années et 6 mois.
Assisté par: Nigel.