Home › Forums › Calendar Products › Events Calendar PRO › Need to exclude recurring events from upcoming listings (after series started)
- This topic has 6 replies, 2 voices, and was last updated 8 years, 11 months ago by
somatic.
-
AuthorPosts
-
April 27, 2017 at 2:28 pm #1275457
somatic
ParticipantI’ve already checked the option for “Show only the first instance of each recurring event” under General settings, and yes, it does remove the recurring “children” events from the listings — EXCEPT when the initial event has already passed, then it shows whichever recurring sub-event is still upcoming!
Here’s why this is a problem: in my case, I am selling attendance to a 5-week class series, and while I do need the recurring events to exist so that they show properly on the calendar, my customers should *never* have the option to purchase the sub-events independently, or to signup for the series once the initial class has passed. I am already redirecting any clicked links on the recurring sub-events back to the parent initial event, which does show the “this event has passed” warning at the top when viewed as a single event page. Honestly I wish I could universally remove the recurring sub-events from being accessed in any way, because they’re never supposed to be sold separately, only as a package series.
But as for the primary event listing page https://curtismethod.com/classes/ (i’ve changed the events slug to classes) — where the query loop calls the upcoming events, I don’t want to have any of the recurring sub-events shown once the series has started. That listing should *only* contain classes which have yet to begin, and right now there are series in progress that are being shown.
(as of right now, Series #102 and #103 have already begun, and yet they have recurring sub-events showing up in the listings, and I’m having to redirect to the parent [initial] event)
I have tried all sorts of query modification with the tribe_events_pre_get_posts hook, or even mucking around with the template in /src/views/list/loop.php — but I can’t seem to target this specific event listing and exclude events which are part of a recurring series.
April 27, 2017 at 3:34 pm #1275474somatic
ParticipantI guess I should clarify that it is useful to see *all* the events in a series when browsing in “Month” view, but not when in List or Map view — so whatever solution for filtering out the recurring sub-events needs to be able to target those specifically.
April 28, 2017 at 3:22 pm #1276086Andras
KeymasterHello Somatic,
Thanks for using our plugins and for reaching out! Let me try to help you with your question.
First off, I do want to note that we are fairly limited in how much we can support custom development questions like this. <span class=”paragraph”>That said, I’d be happy to at least point you in the right direction as best I can. We also have a list of freelancers who we would happily recommend for this level of help.</span>
One thing that came to my mind at the beginning is that you can limit until what date tickets are sold. You just need to fill out the “End sale” field for the ticket, and while this will not make the recurrences disappear, the tickets purchase will not be available after the set date. (https://cloudup.com/cTY0-Brydlx)
Secondly, when you create a custom query for the events, what might help is that in the wp_posts table the recurrences of an event have a value in the post_parent column. The value for the starting event is zero (0), while for all the recurrences it will be the ID of that starting event.
Let me know if this helps!
Cheers,
AndrasApril 28, 2017 at 3:51 pm #1276095somatic
ParticipantI do all my own coding, so I’ll be okay 😉 just need a little pointer in the right direction in regards to where the queries are built for this particular listing, so I can hook/modify it and filter out the child events (I’m aware that I can select for those which have a post_parent value). I’ve been digging through all the source code for events calendar trying to track it down, and I’m at a loss. There’s really quite a few query loops that get fired on the primary /events/ listing page, as I’ve seen when hooking the pre_get_posts action…
So I’m still asking how to specifically target the queries that populate the List and Map views, while allowing the Month views to show all the recurring children (because it’s a helpful visualization on a calendar). Yes, I’ve found the templates in /src/views/list/, and I could override all that output and create my own from scratch — but I’d rather just tweak the query that feeds those loops —
while ( have_posts() ) : the_post();Yes, I can halt ticket sales, but that doesn’t prevent the child events from showing up in the listings past the end date, which is the problem. Honestly I find the whole idea of recurring events (a single event series with multiple, separate dates) where someone can purchase the same ticket for just the last two events in a series of five — as if they had purchased in the beginning, a little confusing. If each event is independently purchasable, it doesn’t make sense to combine them in a “recurring” series. I really think recurring series should be treated as a single entity (that simply contains multiple non-contiguous dates). Offering purchases while the series is already underway, or populating lists with identical-looking entries is pretty confusing.
May 1, 2017 at 5:59 am #1276630Andras
KeymasterHey somatic,
You can influence the query of the different views with
$query->setTake a look at this snippet, line 8-21 is a good start to limit the views where it’s happening.
https://gist.github.com/andrasguseo/6df4bf6911608bcc33d2deb9c795a37f
Below line 21 you can see how you can influence the query based on different attributes.
Does this help?
AndrasMay 23, 2017 at 9:35 am #1287735Support Droid
KeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘Need to exclude recurring events from upcoming listings (after series started)’ is closed to new replies.
