Override Setting to Display First Instance Only of Recurring Events

Home Forums Calendar Products Events Calendar PRO Override Setting to Display First Instance Only of Recurring Events

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1019948
    fortgordonmwr
    Participant

    The setting to display only the first instance of recurring events is very helpful and I’d like to keep that option selected, however, I’ve run into a situation where I would like to temporarily override this setting on a specific page.

    Basically, I need to list all instances of a recurring event within the current month. I can’t seem to figure out how to make this work with the ‘first instance only’ setting selected. Is there a way to override this?

    #1019981
    Nico
    Member

    Hi there @fortgordonmwr,

    Thanks for reaching out to us! I’ll help you out figuring this one out…

    Short answer is NO, long answer is YES, it’s possible to customize the calendar queries. If you would like to investigate a bit more on this, you can hook into tribe_events_pre_get_posts action and modify there query. I’ll leave a code sample to inspect the query below:


    add_action( 'tribe_events_pre_get_posts', 'modify_events_query' );
    function modify_events_query( $query ) {

    var_dump( $query );

    return $query;
    }

    Please let me know if you are willing to take a chance at this,
    Best,
    Nico

    #1020871
    fortgordonmwr
    Participant

    That did it for me! I added the following to my functions.php:

    function modify_events_query( $query ) {
        if (is_page($pageID)) { // Applied only to specific page
            $query->query_vars['tribeHideRecurrence'] = 0;
            return $query;
        }
    }
    add_action( 'tribe_events_pre_get_posts', 'modify_events_query' );

    Thanks for pointing me in the right direction!

    #1021259
    Nico
    Member

    Hey @fortgordonmwr,

    You are welcome! Thanks for sharing your solution here 🙂

    I’ll go ahead and close out this thread, but if you need help with anything else please don’t hesitate to create a new one and we will be happy to assist you.

    Best,
    Nico

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Override Setting to Display First Instance Only of Recurring Events’ is closed to new replies.