Created
March 21, 2023 03:31
-
-
Save rickalday/f0f7fe819c056434346dd36e6805692a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Adds a CCAvenue Phone Tag: {ccavenue_phone} | |
* This function creates a custom Give email template tag | |
* | |
* @param array $email_tags List of email tags. | |
* | |
* @return array | |
*/ | |
function ccavenue_donation_phone_email_tag( $email_tags ) { | |
$new_email_tag = array( | |
'tag' => 'ccavenue_phone', | |
'description' => esc_html__( 'This tag outputs the donation phone for donations made with CCAVenue', 'give' ), | |
'function' => 'get_ccavenue_donation_phone', | |
'context' => 'general', // Context can be general, donor, form or donation | |
); | |
array_push( $email_tags, $new_email_tag ); | |
return $email_tags; | |
} | |
add_filter( 'give_email_tags', 'ccavenue_donation_phone_email_tag' ); | |
function get_ccavenue_donation_phone( $tag_args ) { | |
$output = ''; | |
$phone_number = give_get_meta( $tag_args['payment_id'], '_give_ccavenue_phone_number', true ); | |
if ( $phone_number ) { | |
$output = $phone_number; | |
} else { | |
$output = ''; | |
} | |
return $output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment