Skip to content

Instantly share code, notes, and snippets.

@matheuswd
Created September 7, 2022 11:02
Show Gist options
  • Save matheuswd/24c0780dfd6ce776ac0688bc16d8cf8c to your computer and use it in GitHub Desktop.
Save matheuswd/24c0780dfd6ce776ac0688bc16d8cf8c to your computer and use it in GitHub Desktop.
Creates the {donor_title} tag for the GiveWP PDF Receipt
<?php
function custom_pdf_tag_donor_title( $template_content, $args ) {
$donor_title = isset( $args['buyer_info']['title'] ) && $args['buyer_info']['title'] !== '' ? $args['buyer_info']['title'] : __('', 'give');
$template_content = str_replace( '{donor_title}', $donor_title, $template_content );
return $template_content;
}
add_filter( 'give_pdf_compiled_template_content', 'custom_pdf_tag_donor_title', 999, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment