Created
March 3, 2017 23:41
-
-
Save hemusyl/2d4a3bfb296044c57dd3e3481f55659e to your computer and use it in GitHub Desktop.
TOTAL DOWNLOADS IN EASY DIGITAL DOWNLOADS // TOP SELLING ITEMS ON EDD
This file contains hidden or 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
http://rubelmiah.com/show-top-selling-items-edd/ | |
HOW TO SHOW TOP SELLING ITEMS ON EDD | |
<?php $popular_items = new WP_Query (array( | |
'post_type' => 'download', | |
'orderby' => 'meta_value_num', | |
'meta_query' => array( | |
'relation' => 'AND', | |
array( | |
'key' => '_edd_download_sales', | |
'compare' => '>', | |
'value' => 0, | |
'order' => 'DESC', | |
), | |
), | |
'posts_per_page' => 3 | |
)); ?> | |
--------------------------------------------------------- | |
http://rubelmiah.com/how-to-show-total-downloads-in-easy-digital-downloads-edd/ | |
HOW TO SHOW TOTAL DOWNLOADS IN EASY DIGITAL DOWNLOADS (EDD) | |
Follow the below instruction to show total Downloads in Easy Digital Downloads (EDD). | |
Go to functions.php and paste this code: | |
function edd_count_total_file_downloads() { | |
global $edd_logs; | |
return $edd_logs->get_log_count( null, 'file_download' ); | |
} | |
Then to bring it all together, you can get the total number of customers, products, and file downloads with the following PHP: | |
if ( class_exists( 'Easy_Digital_Downloads' ) ) { | |
?> | |
<span class="edd-customer-count"> | |
<?php echo edd_count_total_customers(); ?> Customers | |
</span> | |
<span class="edd-download-count"> | |
<?php $downloads_count = wp_count_posts( 'download' ); echo $downloads_count->publish; ?> Products | |
</span> | |
<span class="edd-file-download-count"><?php echo edd_count_total_file_downloads(); ?> Downloads</span> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment