Created
November 13, 2024 21:21
-
-
Save chikaibeneme/2cc67d43f326833a5d9daadedce24c9e to your computer and use it in GitHub Desktop.
Add Virtual Meeting URL and Organizer Link to Event Description in iCal Feed.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Insert virtual event meeting URL and organizer link at the end of the description. | |
| * | |
| * @param array $item Array of items describing the event in ical format. | |
| * @param object $event The event object. | |
| * | |
| * @return array | |
| */ | |
| add_filter( 'tribe_ical_feed_item', function ( $item, $event ) { | |
| // Append virtual meeting URL if it exists | |
| if ( isset( $event->virtual_meeting_url ) && ! empty( $event->virtual_meeting_url ) ) { | |
| $meeting_url = esc_url( $event->virtual_meeting_url ); | |
| $item['DESCRIPTION'] .= "\\n\\nClick on this link to join the meeting:\\n" . $meeting_url; | |
| } | |
| // Append organizer URL if it exists | |
| $organizer_id = tribe_get_organizer_id( $event->ID ); // Get the organizer ID associated with this event | |
| if ( $organizer_id ) { | |
| $organizer_url = get_permalink( $organizer_id ); // Get the direct link for the organizer | |
| if ( $organizer_url ) { | |
| $item['DESCRIPTION'] .= "\\n\\nOrganizer details:\\n" . esc_url( $organizer_url ); | |
| } | |
| } | |
| return $item; | |
| }, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment