Forked from Creativenauts/edd-download-grid-loop.php
Created
November 15, 2017 10:54
-
-
Save joviczarko/d9e2ff8a6c5bb6887070fd63d09a9ffd to your computer and use it in GitHub Desktop.
Easy Digital Downloads - Download Grid Loop Function
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
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