/** * Get the content to be displayed for the extra donation field. * * @param string $default * @param array $args * @param Charitable_Email $email * @return string */ function ed_charitable_get_extra_donation_field_value($default, $args, $email) { if (!$email->has_valid_donation()) { return ''; } /** * Get the actual content you want to display in the emails. In * this example, we're showing a custom meta field with a key * `extra_donation_field`. */ return get_post_meta($email->get_donation()->ID, 'extra_donation_field', true); }
/** * Display the National ID # in emails. * * This function will only work if you are using Charitable 1.4+. * * Once you have added this snippet, you can display the value in your * email like this: [charitable_email show=national_id_number] * * To adapt this to your needs, you need to pay special attention to the * filter name. In the example below, our filter name is * `charitable_email_content_field_value_national_id_number`. The * `national_id_number` part of this filter name should be whatever you * use in the shortcode for the show parameter. In other words, if this * is your shortcode: * * [charitable_email show=my_amazing_field] * * This would be your filter name: * * charitable_email_content_field_value_my_amazing_field * * Out of convention, we suggest replacing both with the identifier * for your field that you use throughout, which is what we have done * in this example. * * @param string $value * @param array $args * @param Charitable_Email $email * @return string */ function ed_show_national_id_number_in_email($value, $args, Charitable_Email $email) { if ($email->has_valid_donation()) { $value = ed_donation_get_national_id_number($email->get_donation()); } return $value; }