Created
May 18, 2021 15:25
-
-
Save matheuswd/d6fe91e03c864ce31b9a11aa97f58db8 to your computer and use it in GitHub Desktop.
Adds the {gift_aid_status} tag to the PDF Receipt
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 | |
function give_add_gift_aid_status_pdf_tag( $template_content, $args ) { | |
// during testing, uncomment the next line to see a full printed array of the possible args that you can query | |
// var_dump("<pre>".print_r($args,true)."</pre>"); | |
$gift_aid_status = isset( $args['payment_meta']['_give_gift_aid_accept_term_condition'] ) && $args['payment_meta']['_give_gift_aid_accept_term_condition'] == 'on' ? 'Yes' : 'No'; | |
$template_content = str_replace( '{gift_aid_status}', $gift_aid_status, $template_content ); | |
return $template_content; | |
} | |
add_filter( 'give_pdf_compiled_template_content', 'give_add_gift_aid_status_pdf_tag', 999, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment