Block all recurring events from a particular day (e.g., Crhist

Home Forums Calendar Products Events Calendar PRO Block all recurring events from a particular day (e.g., Crhist

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1034798
    Sean Sullivan
    Participant

    Hello:

    One of my clients is a gym; we use the Events Calendar to list their class schedules, which consists of about 50 events per day. Everything in the calendar is a recurring event (e.g., every Wednesday).

    However, we have no classes on holidays, like Christmas Day or New Years. But going in an adding exceptions for 50 events is tedious, and I’m hoping there’s a better way. Is there some code that will block all events on a certain date?

    #1035218
    Cliff
    Member

    Hi Sean. Interesting idea.

    You could HIDE the events with CSS from the month view via this CSS:

    [data-day="2015-12-10"] > .tribe_events {
    display: none;
    }

    However, this isn’t really recommended because, if someone used a different view (e.g. Week), it would NOT hide the events. If someone got the direct link to the event, that’d still work too, which is probably not what you’re wanting.

    If you’re wanting a more strict “protection” (i.e. actually not working on those dates), you’d need to use PHP, such as our tribe_events_pre_get_posts hook.

    Please let me know your feedback. Thanks.

    #1039735
    Sean Sullivan
    Participant

    Hey Cliff,

    I’ve looked around in the documentation and forums to see if I can find some information on the tribe_events_pre_get_posts hook, but can’t find much.

    Can you give me a nudge in the right direction — e.g., which template file I should look in to accomplish this?

    Sean

    #1039965
    Cliff
    Member

    Think of it like pre_get_posts but for event queries.

    tribe_events_pre_get_posts is applied in these ways:

    In the free/core plugin:

    • add_action is located once in /wp-content/plugins/the-events-calendar/src/Tribe/Main.php
    • do_action is located three times in /wp-content/plugins/the-events-calendar/src/Tribe/Query.php

    In PRO add-on:

    • add_action is located once in /wp-content/plugins/events-calendar-pro/src/Tribe/Geo_Loc.php
    • and twice in /wp-content/plugins/events-calendar-pro/src/Tribe/Main.php

    You can search our site and gists for possible additional help.

    I hope this info helped! 🙂

    #1076156
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Block all recurring events from a particular day (e.g., Crhist’ is closed to new replies.