Skip to content

Instantly share code, notes, and snippets.

@xnau
Last active February 18, 2025 19:34
Show Gist options
  • Save xnau/6dea8af8bbbd4ed9f8e875f16bc6af0e to your computer and use it in GitHub Desktop.
Save xnau/6dea8af8bbbd4ed9f8e875f16bc6af0e to your computer and use it in GitHub Desktop.
Shows a simplified way to add a custom email value tag for use in a Participants Database email template
<?php
/**
* Plugin Name: PDb Custom Email Tag
* Version: 0.1
*/
// this is a proof-of-concept example
add_filter( 'pdb-template_email_tag_map', 'xnau_add_custom_email_tag', 10, 2 );
/**
* adds the tag to the tag map
*
* @param array $tag_map as $tagname => $value
* @param string $context usually the template name but identifies the current context of
* the email template, you can use that to determine whether to add
* the tag or not
* @return array
*/
function xnau_add_custom_email_tag( $tag_map, $context ) {
// we're adding a tag "custom"
// this tag would be used in the email template as [custom]
// and would be replaced by the value in the email
$tagmap['custom'] = 'custom value';
return $tag_map;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment