Remove iCal and Google Calendar links on single event if the event has passed

Home › Forums › Calendar Products › Events Calendar PRO › Remove iCal and Google Calendar links on single event if the event has passed

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #939827
    prydonian
    Participant

    tribe_is_past() doesn’t seem to work to filter out the content if the event has passed on a single event template. How would I go about removing these links in this instance?

    #939970
    Brian
    Member

    Hi,

    I can help you out here. The tribe_is_past() only works in the loop and not on a single event.

    We use this coding to detect if is is a past event, you maybe to modify it to work for you:

    global $post;

    // Check if event has passed
    $gmt_offset = ( get_option( 'gmt_offset' ) >= '0' ) ? ' +' . get_option( 'gmt_offset' ) : " " . get_option( 'gmt_offset' );
    $gmt_offset = str_replace( array( '.25', '.5', '.75' ), array( ':15', ':30', ':45' ), $gmt_offset );

    if ( ! tribe_is_showing_all() && strtotime( tribe_get_end_date( $post, false, 'Y-m-d G:i' ) . $gmt_offset ) <= time() ) {
    TribeEvents::setNotice( 'event-past', __( 'This event has passed.', 'tribe-events-calendar' ) );
    }

    Let me know if you have any follow up questions.

    Thanks

    #939976
    prydonian
    Participant

    That worked. thanks.

    #939981
    Brian
    Member

    Great, glad it helps, I am going to go ahead and close this ticket, but if you need help on this or something else please post a new ticket.

    Thanks!

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Remove iCal and Google Calendar links on single event if the event has passed’ is closed to new replies.