Last active
May 30, 2016 21:07
-
-
Save X-Raym/8ee81ddae418ebe0fccf to your computer and use it in GitHub Desktop.
Easy Digital Downloads - Downloads Count Shortcode
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 | |
// Optional attributs supported : id, offset | |
function edd_download_count_shortcode( $atts ) { | |
$post_id = get_the_ID(); | |
$a = shortcode_atts( array( | |
'offset' => 0, | |
'id' => $post_id, | |
), $atts ); | |
if( function_exists( 'edd_get_download_sales_stats' ) ) { | |
$download_count = edd_get_download_sales_stats( $a['id'] ) + $a['offset']; | |
} else { | |
$download_count = false; | |
} | |
return $download_count; | |
} | |
add_shortcode( 'edd_download_count', 'edd_download_count_shortcode' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment