Created
September 6, 2021 20:21
-
-
Save steveclason/e38f6636806a5bbc1a0c88c8e34057df to your computer and use it in GitHub Desktop.
LearnDash, WordPress, add serial number to certificate.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* LearnDash in WordPress | |
* Display a serial number on the printed course certificate. Serial number is a concatenation of user_id abd certificate_id. | |
* Attribute stuff is there just in case, does nothing now. | |
* I usually put shortcodes in a shortcodes.php file and require it in functions.php, but whatever. | |
*/ | |
if ( !function_exists ( 'ce_cert_serialize_function' )) { | |
function ce_cert_serialize_function( $atts ) { | |
$a = shortcode_atts( array( | |
// default attributes | |
// 'callout_title' => 'No Title' | |
), $atts ); | |
// TODO Concatenate userid abnd courseid? | |
$user_id = get_current_user_id(); | |
$cert_id = get_the_id(); | |
// $html = '<p>ABC123</p>'; | |
$html = 'Certificate No. ' . $user_id . '-' . $cert_id; | |
return $html; | |
} // shortcode function. | |
} // function_exists. | |
add_shortcode( 'cert_serialize', 'ce_cert_serialize_function' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment