WordPress Snippets at WPcustoms

List download categories with EDD

If you are using EasyDigitalDownloads plugin you may want to build a template which lists all download categories. This function prints an ul-list for each category you’ve set in your EDD downloads.
Add the snippet to your functions and call it in a template file where you desire to list the EDD categories.


/**
 * Snippet Name: List download categories with EDD
 * Snippet URL: http://www.wpcustoms.net/snippets/list-download-categories-edd/
 */
 function wpc_list_edd_categories() {
    $taxonomy = 'download_category'; // EDD's taxonomy for categories
    $terms = get_terms( $taxonomy ); // get the terms from EDD's download_category taxonomy

echo '
    '; foreach ( $terms as $term ) : echo '
  • '.$term->name.'
  • '; endforeach; echo '
'; }