Skip to content

Instantly share code, notes, and snippets.

@JudeRosario
Last active August 29, 2015 14:15
Show Gist options
  • Save JudeRosario/2587249950e147f83c5f to your computer and use it in GitHub Desktop.
Save JudeRosario/2587249950e147f83c5f to your computer and use it in GitHub Desktop.
Appointements + Service Provider Phone in emails
// Append the Phone Number to the Confirmation / Reminder mails
add_filter( 'app_confirmation_message', 'append_phone_to_app_email', 10, 3 );
add_filter( 'app_reminder_message', 'append_phone_to_app_email', 10, 3 );
function append_phone_to_app_email( $msg, $obj, $app_id) {
$worker = $obj->worker;
// Get Worker Phone from $meta table
$worker_phone = get_user_meta($worker, "app_phone", true);
if ( $worker_phone ) {
// Search and replace the WORKER_CONTACT string
$msg = str_replace( 'WORKER_CONTACT', 'Phone: ' . $worker_phone, $msg );
}
return $msg;
}
@JudeRosario
Copy link
Author

Simply copy/paste this code snippet into the functions.php of a child theme or a site specific code plugin if you use one. Then use the placeholder WORKER_CONTACT in your email messages, it will be replaced with the Service Provider Phone number

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment