Skip to content

Instantly share code, notes, and snippets.

@actual-saurabh
Last active May 25, 2018 13:51
Show Gist options
  • Save actual-saurabh/05c31c4c418116e34ded6811d182af62 to your computer and use it in GitHub Desktop.
Save actual-saurabh/05c31c4c418116e34ded6811d182af62 to your computer and use it in GitHub Desktop.
Custom Merge Code for Certificate Title LifterLMS
<?php // Do not copy this line
// Copy from under this line and paste into your child theme's functions.php
add_filter( 'llms_certificate_merge_codes', 'llms_custom_certificate_title_merge_code', 10, 2 );
function llms_custom_certificate_title_merge_code( $merge_codes_array, $certificate_object ){
// add custom certificate title merge code to existing ones
$merge_codes_array['{certificate_title}'] = $certificate_object->title;
// return new merge code list
return $merge_codes_array;
}
add_filter( 'llms_merge_codes_for_button', 'llms_custom_certificate_title_merge_code_for_button', 10, 2 );
function llms_custom_certificate_title_merge_code_for_button( $codes, $screen ){
// don't run on emails
if( $screen->post_type != 'llms_certificate' ){
return;
}
$codes['{certificate_title}'] = "Certificate Title";
return $codes;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment