How to show total Downloads in Easy Digital Downloads (EDD)

By In Code, Resource — October 13, 2015

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
}

Thank you for reading this.

  • GINOM HANGSHING

    Where is the Function.php located.? When i goto plugin editor in EDD, there are so many function such as
    easy-digital-downloads/includes/ajax-functions.php
    easy-digital-downloads/includes/download-functions.php

    and many more.

    Can You Please Provide me more details on these…

    • This is not plugin php file. You need go to theme directory “theme-directory > functions.php” and paste first code.

      • GINOM HANGSHING

        Thank You. I have pasted the code and where will the results be shown? I host an mp3 website but by pasting this cost, nothing happens? my mail: h.thangginom@gmail.com

        • Give me your website link.

          • GINOM HANGSHING

            can you provide me your mail? since my website is not yet publish to the public. we are in the progress of construction. I will send in your mail.

          • Sure abs.rubel1[at]gmail.com

          • GINOM HANGSHING

            check your mail
            Thanks

          • OK