-
-
Save jeffaspenburg/30cd12a28abb9f54f34422ec50ee5280 to your computer and use it in GitHub Desktop.
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 | |
/** | |
* Shortcode: EDD Product Version | |
* | |
* [edd_product_version] | |
* You can add id="post_id_here" to display the version number of a defined product. | |
*/ | |
function shortcode_edd_product_version($atts) { | |
$atts = shortcode_atts(array( | |
'id' => get_the_ID(), | |
), $atts); | |
$args = array( | |
'download_id' => get_post_meta($atts['id'], '_edd_sl_version', true), | |
'download_name' => get_the_title($atts['id']), | |
); | |
$result = null; | |
if (class_exists('EDD_Software_Licensing')) { | |
$result = $args['download_id']; | |
} | |
return $result; | |
} | |
add_shortcode('edd_product_version', 'shortcode_edd_product_version'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment