Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the featured image to output of Download Details widget
- Loading branch information
Showing
1 changed file
with
18 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
/** | ||
* Add the featured image to output of Download Details widget | ||
*/ | ||
|
||
function sd_edd_download_details_widget_thumbnail( $instance ) { | ||
|
||
// get the ID of the current post | ||
$post_id = get_the_ID(); | ||
|
||
// grab featured image of the appropriate download | ||
if ( 'current' == $instance['download_id'] ) { | ||
echo get_the_post_thumbnail( $post_id ); | ||
} else { | ||
echo get_the_post_thumbnail( $instance['download_id'] ); | ||
} | ||
} | ||
add_action( 'edd_product_details_widget_before_purchase_button', 'sd_edd_download_details_widget_thumbnail' ); |