Skip to content

Instantly share code, notes, and snippets.

@wpmudev-sls
Created January 16, 2019 09:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wpmudev-sls/e899d2bd85bb8dd02ce1934ff9111639 to your computer and use it in GitHub Desktop.
Save wpmudev-sls/e899d2bd85bb8dd02ce1934ff9111639 to your computer and use it in GitHub Desktop.
Appointment - GOOGLE_CALENDAR_LINK custom placeholder
<?php
/**
* Plugin Name: Appointment - GOOGLE_CALENDAR_LINK custom placeholder
* Description: Appointment - GOOGLE_CALENDAR_LINK custom placeholder
* Author: Ariful Islam @ WPMUDEV
* Author URI: https://premium.wpmudev.org/profile/itsarifulislam
* License: GPLv2 or later
*/
add_filter( 'appointments_notification_replacements', function( $replacement, $notification_type, $text, $r ) {
global $appointments;
$gcal_link = esc_url_raw( $appointments->gcal( $r->service, strtotime( $r->start, $appointments->local_time ), strtotime( $r->end, $appointments->local_time ), true, $r->address, $r->city ) );
$other_replacement = array(
'/\bGOOGLE_CALENDAR_LINK\b/U' => $gcal_link
);
return $replacement = array_merge( $replacement, $other_replacement );
}, 10, 4 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment