hide recurring events with user toggle and default \"on\"

Home Forums Calendar Products Events Calendar PRO hide recurring events with user toggle and default \"on\"

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1216376
    continuit
    Participant

    Hi Guys,

    Is there a way I can change the default setting of the user toggle (front-end option for displaying recurring events) so that it’s on by default instead of off? (preferably so I can set this for each page).

    For example, by default I want to display all recurring events but for some views (like a photo view embedded in a page with the shortcode), I want to display only the first occurrence.

    Cheers,
    Glenn

    #1216852
    Nico
    Member

    Hi there Glenn,

    Thanks for getting in touch with us!

    Hopefully we have a snippet to do this:


    /*
    * Checks the front-end box "Show only the first upcoming instance of recurring events" by default
    */
    function tribe_subsequent_recurrence_default( $option, $name, $default ) {
    if ( $name === 'hideSubsequentRecurrencesDefault' && ! is_admin() ) $option = true;
    return $option;
    }
    add_filter( 'tribe_get_option', 'tribe_subsequent_recurrence_default', 10, 3 );

    You’ll need to add the appropriate conditional for this to only affect the page with the shortcode!

    Please let me know if you can customize it or if you still need help,
    Best,
    Nico

    #1217772
    continuit
    Participant

    Hey Nico, thanks for that. Much appreciated.

    BTW: I found a quick work-around while I was waiting – just change the link to page to call the ?action=blablabla&tribeHideRecurrence=1 (in case anyone wants to use this method instead).

    Cheers,
    Glenn

    #1218092
    Nico
    Member

    Hey Glenn,

    Stocked to hear this worked for you! Also, you’ve found a nice workaround 😉

    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 ‘hide recurring events with user toggle and default \"on\"’ is closed to new replies.