Created
April 2, 2016 05:22
-
-
Save Creativenauts/1c3daea4bd4d6447e11a6a5e2ea599c9 to your computer and use it in GitHub Desktop.
Easy Digital Downloads - Download Grid Loop Function
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
function get_edd_posts($per_page, $order, $category = '', $exclude_category = '') { | |
$exclude_categories = explode(',', $exclude_category); | |
$product_args = array( | |
'tax_query' => array ( | |
array( | |
'taxonomy' => 'download_category', // Download Category | |
'terms' => $exclude_categories, // Download Category Exclusions | |
'field' => 'slug', // Term Slug | |
'operator' => 'NOT IN' // Selection operator - use IN to include, NOT IN to exclude | |
), | |
), | |
'post_type' => 'download', // Post Type EDD | |
'download_category' => $category, // Download Category | |
'posts_per_page' => $per_page, // Posts Per Page | |
'order' => $order // Order By | |
); | |
$products = new WP_Query($product_args); | |
while ($products->have_posts()) : $products->the_post(); | |
the_permalink(); // Download Permalinks | |
the_post_thumbnail(); // Download Image | |
the_title(); // Download Title | |
get_edd_parent_category(); // Checkout my Gist For This Function | |
get_download_price(); // Checkout my Gist For This Function | |
endwhile; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment