Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Created March 22, 2016 10:43
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 Pebblo/0f6c5fdcd31f572c7bf1 to your computer and use it in GitHub Desktop.
Save Pebblo/0f6c5fdcd31f572c7bf1 to your computer and use it in GitHub Desktop.
This plugin can be used to add custom shortcodes to the EE3 confirmation emails. Currently it adds the [reg_date] shortcode which parses to the date and time that the user laced the registration.
<?php
/*
Plugin Name: Event Espresso site specific functions
Description: Add custom functions for Event Espresso to this plugin.
/* Begin Adding Functions Below This Line; Do not include an opening PHP tag as this sample code already includes one! */
//Add a custom shortcode for use within the emails.
function espresso_custom_email_shortcode( $shortcodes ) {
$shortcodes[] = "[reg_date]";
return $shortcodes;
}
add_filter('filter_hook_espresso_post_replace_shortcode_search_values', 'espresso_custom_email_shortcode');
//Add the value for the custom shortcode we just added above.
function espresso_custom_email_shortcode_value( $shortcode_values, $data ) {
$shortcode_values[] = $data->attendee->date;
return $shortcode_values;
}
add_filter('filter_hook_espresso_post_replace_shortcode_replace_values', 'espresso_custom_email_shortcode_value', 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment