• Resolved Tim Griffin

    (@tgriff)


    The events calendar “Add to Calendar” drop down is correctly offering the date/title/information for the individual events – BUT, due to page builder, a lot of shortcodes are getting pulled into the description on the ical and google calendar events.

    I found a way to filter and customize the Google calendar link, but I see no way to apply a similar customization to the ical / outlook 365 links. Is there are a way to filter/customize the ical and outlook 365 add to calendar links?

    Here is a function / filter I’ve added to pull in the excerpt instead of the full content, and remove any paragraph tags that get pulled into the event description.

    function custom_tec_gcal_link_parameters( $gcal_params, $event ) {
    // Get the event excerpt using tribe_events_get_the_excerpt
    $event_excerpt = tribe_events_get_the_excerpt( $event->ID, null );

    // Remove the <p> tags if present
    $event_excerpt = preg_replace('/^<p>|<\/p>$/', '', $event_excerpt);

    // Update the 'details' parameter in the Google Calendar link parameters
    $gcal_params['details'] = $event_excerpt;

    return $gcal_params;
    }
    add_filter( 'tec_views_v2_single_event_gcal_link_parameters', 'custom_tec_gcal_link_parameters', 10, 2 );

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support tristan083

    (@tristan083)

    Hi @tgriff ,

    Thank you for reaching out.

    I am unable to provide you with the code you need for your situation, as this is beyond our scope of support. But, I recommend you try using the tribe_ical_feed_item filter hook.

    Thread Starter Tim Griffin

    (@tgriff)

    So I found this was helpful for the icalendar config… not affecting the outlook export link though.

    function custom_tribe_ical_feed_item( $item, $event_post ) {
    // Get the event excerpt using tribe_events_get_the_excerpt
    $event_excerpt = tribe_events_get_the_excerpt( $event_post->ID, null );

    // Remove the <p> tags if present
    $event_excerpt = preg_replace('/^<p>|<\/p>$/', '', $event_excerpt);

    // Update the 'DESCRIPTION' component in the iCal feed item
    $item['DESCRIPTION'] = $event_excerpt;

    return $item;
    }
    add_filter( 'tribe_ical_feed_item', 'custom_tribe_ical_feed_item', 10, 2 );
    Plugin Support Darian

    (@d0153)

    Hi @tgriff

    Thanks for your message.

    Let me check with the team if we have a similar workaround for the outlook export link. I’ll update you once I have more information.

    Plugin Support Darian

    (@d0153)

    Hi @tgriff

    Thanks for patiently waiting. One of my colleagues just replied.

    You should be able to use this filter in a similar fashion:? tec_events_ical_outlook_single_event_import_url

    This is the function/docblock that runs with that filter:

            /**
    * Filter the Outlook single event export url for a Zoom source event.
    *
    * @since 1.13.0
    *
    * @param string $url The url used to subscribe to a calendar in Outlook.
    * @param string $base_url The base url used to subscribe in Outlook.
    * @param array<string|string> $params An array of parameters added to the base url.
    * @param Outlook_Methods $outlook_methods An instance of the link abstract.
    *
    * @return string The export url used to generate an Outlook event for the single event.
    */
    public function filter_outlook_single_event_export_url( $url, $base_url, $params, $outlook_methods ) {
    return $this->container->make( Event_Export::class )->filter_outlook_single_event_export_url( $url, $base_url, $params, $outlook_methods );
    }

    As always, please test it first on your staging site before applying it to your live site.

    Let me know if you have further concerns.

    Plugin Support Darian

    (@d0153)

    Hi there,

    It appears that there hasn’t been any recent activity on this thread, so we’ll consider it resolved. However, if you have any additional questions or concerns, feel free to start a new thread.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Add to Calendar – Google, iCal, Outlook 365’ is closed to new replies.