Reply To: Filter Events
Home › Pro Support Forums › General Support › Filter Events › Reply To: Filter Events
Thanks… I think this clears it up. What you’re describing is not really possible as the plugin is currently designed. It might be possible with some custom code. I see a couple of possible ways of doing this.
First, it depends on which view you’re using. I think this kind of thing is really tailored only to List view. It doesn’t really make sense to display in any other view (at least as I am understanding the objective).
The PHP Way
Here you would do some pre-processing; you’d need to parse the feed of the first calendar, to find the date of the next upcoming event. Once you have that date, you would dynamically generate an ICS Calendar shortcode (including all of the feeds) that uses that date as the startdate
parameter. It would also need to include limitdays="1"
and count="999"
(or some arbitrarily large number).
The JavaScript Way
This would use the existing shortcode as-is (possibly once again adding count="999"
), and then use JavaScript/jQuery to find the next future event from the first feed. This would involve a jQuery selector something like this: jQuery('.ics-calendar .event:not(.past)[data-feed-key="0"]')
. You’d actually need to find the first instance of this… which is eluding my brain at the moment. (I just know you can’t use :first-of-type
because that only looks at HTML tags, not CSS selectors.) Then you’d hide all of the dates in the list except this one, which you could find by adding .closest('.ics-calendar-date-wrapper')
to your jQuery selector.