Skip to content

Instantly share code, notes, and snippets.

@rickalday
Created July 16, 2025 23:58
Show Gist options
  • Save rickalday/3ba75a28058bf0bca3545ea2a03358be to your computer and use it in GitHub Desktop.
Save rickalday/3ba75a28058bf0bca3545ea2a03358be to your computer and use it in GitHub Desktop.
Sample function to include form custom field data in GiveWP PDF Receipts
<?php
function givewp_pdf_cutom_tags( $template_content, $args ) {
//$donor_info = give_get_payment_meta_user_info( $args['donation_id'] );
$post = get_post($args['donation_id']);
if ($post->post_parent) {
$post_id = $post->post_parent;
} else {
$post_id = $args['donation_id'];
}
$codice_fiscale = get_post_meta($post_id, 'meta_donation_codice_fiscale', true);
$template_content = str_replace( '{meta_donation_codice_fiscale}', $codice_fiscale, $template_content );
return $template_content;
}
add_filter( 'give_pdf_compiled_template_content', 'givewp_pdf_cutom_tags', 900, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment