We'll create fresh WordPress site with Easy Digital Downloads Featured Downloads installed. You have 20 minutes to test the plugin after that site we'll be deleted.
This plugin requires Easy Digital Downloads. It’s aimed at developers/clients who need to show a list of featured downloads.
Add the “featured” attribute to the existing [downloads] shortcode provided by Easy Digital Downloads:
[downloads featured="yes"]
The following code can be used to show the featured downloads anywhere in your theme:
echo do_shortcode( '[downloads featured="yes"]' );
You can include any other attributes supported by the [downloads] shortcode.
To build your own query using WP_Query you can use the meta_key
parameter with a value of edd_feature_download
. The following example builds a simple unordered list with all the featured downloads.
<?php
$args = array(
'post_type' => 'download',
'meta_key' => 'edd_feature_download',
);
$featured_downloads = new WP_Query( $args );
if( $featured_downloads->have_posts() ) : ?>
<ul>
<?php while( $featured_downloads->have_posts() ) : $featured_downloads->the_post(); ?>
<li>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<?php the_title(); ?>
</a>
</li>
<?php endwhile; ?>
</ul>
<?php endif; wp_reset_postdata(); ?>