Skip to content

Instantly share code, notes, and snippets.

@hlashbrooke
Last active October 13, 2017 12:58
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hlashbrooke/11402653 to your computer and use it in GitHub Desktop.
Save hlashbrooke/11402653 to your computer and use it in GitHub Desktop.
Sensei Certificates: Use custom font in certificate PDFs
<?php
/**
* Custom fonts MUST be uploaded to the following directory:
* /wp-content/plugins/sensei-certificates/lib/tfpdf/font/unifont/
*
* All custom fonts MUST be TrueType fonts (.ttf)
*
* Only one custom font can be used and it will override ALL fonts in ALL templates
**/
add_filter( 'sensei_certificates_custom_font', 'certificates_custom_font', 10, 1 );
function certificates_custom_font( $font ) {
// Font family and file name MUST be supplied
$font = array(
'family' => 'FontFamily',
'file' => 'font-file.ttf',
);
// Sepcifying font size is optional - if it is left out the then the sizes specified in the template will be used
$font['size'] = 18;
return $font;
}
?>
@beags121
Copy link

Since update to latest Sensei this function causes an error when previewing/accessing the Sensei Certificates from either admin or customer interface. # #

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment