Last active
April 28, 2021 10:03
-
-
Save raftaar1191/88ef4f55de7b1b56b1eec12d52dc9edd to your computer and use it in GitHub Desktop.
Change the Donation Receipt text in Receipt page of GiveWP
This file contains hidden or 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
| /** | |
| * Call before the Donation Receipt text is display | |
| */ | |
| function give_custom_give_payment_receipt_header_before_callback() { | |
| add_filter( 'gettext', 'child_give_text_switcher', 10, 3 ); | |
| } | |
| add_action( 'give_payment_receipt_header_before', 'give_custom_give_payment_receipt_header_before_callback' ); | |
| /** | |
| * Remove the filter after the text is display | |
| */ | |
| function give_custom_give_payment_receipt_header_after_callback() { | |
| remove_filter( 'gettext', 'child_give_text_switcher', 10 ); | |
| } | |
| add_action( 'give_payment_receipt_header_after', 'give_custom_give_payment_receipt_header_after_callback' ); | |
| /** | |
| * Change Name in Donation receipt page | |
| */ | |
| function child_give_text_switcher( $translations, $text, $domain ) { | |
| if ( $domain == 'give' && $text == 'Donation Receipt' ) { | |
| $translations = 'ADD TEXT HERE'; | |
| } | |
| return $translations; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment