Skip to content

Instantly share code, notes, and snippets.

@raftaar1191
Last active April 28, 2021 10:03
Show Gist options
  • Select an option

  • Save raftaar1191/88ef4f55de7b1b56b1eec12d52dc9edd to your computer and use it in GitHub Desktop.

Select an option

Save raftaar1191/88ef4f55de7b1b56b1eec12d52dc9edd to your computer and use it in GitHub Desktop.
Change the Donation Receipt text in Receipt page of GiveWP
/**
* 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