Last active
November 29, 2023 22:05
-
-
Save zackkatz/9acc181ae9bbd1c339ca614e64ccb733 to your computer and use it in GitHub Desktop.
GravityCalendar - Add a sample event feed
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
<?php | |
/** | |
* Example of how to add a sample event source. | |
* | |
* @param array $sources The array of event sources. { | |
* @type string $url The URL of the event source. | |
* @type string $type The type of event source. Either `ics` or `json`. | |
* @type string $color The color of the event source. | |
* } | |
* @param int $form_id The ID of the Gravity Forms form being displayed. | |
* @param int $feed_id The ID of the current Calendar feed. | |
* | |
* @return array | |
*/ | |
add_filter( 'gk/gravitycalendar/event_sources', function( $sources, $form_id = 0, $feed_id = 0 ) { | |
// | |
// UPDATE THE NUMBER BELOW! | |
// This is the ID of the feed you want to modify. | |
// | |
$feed_id_to_modify = 4; | |
// Only add the event source to the feed with ID 4. | |
if ( (int) $feed_id !== $feed_id_to_modify ) { | |
return $sources; | |
} | |
$sources[] = [ | |
'url' => 'https://ics.calendarlabs.com/55/241df737/Jewish_Holidays.ics?', | |
'type' => 'ics', | |
'color' => 'blue', // Use any CSS-compatible color name or hex value ("#ff0000" or "#f00" or "red"). | |
]; | |
return $sources; | |
}, 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment