PDF-only Content

Note: this requires the PW Gift Cards Pro version.

If you want some text to appear only in the PDF version (for example, how to print and redeem in-store) you can use the template hooks to insert text at any location in the gift card. Follow these steps:

Note: If you are more comfortable adding the code to your functions.php you can do that instead of using Code Snippets.

1. Download the free Code Snippets plugin: https://wordpress.org/plugins/code-snippets/
2. Create a new Snippet with the following code:

add_action( 'pwgc_email_top', 'pw_gift_card_pdf_text' );
function pw_gift_card_pdf_text( $item_data ) {
    if ( $item_data->is_pdf ) {
        ?>
        <p>
            Output the custom text for PDF version.
        </p>
        <?php
    }
}


 

The following locations are available, just change it in the first line above:

  • pwgc_email_top
  • pwgc_email_before_recipient
  • pwgc_email_before_from
  • pwgc_email_before_message
  • pwgc_email_before_gift_card
  • pwgc_email_inside_gift_card_top
  • pwgc_email_inside_gift_card_bottom
  • pwgc_email_after_gift_card
  • pwgc_email_bottom
Skip to content