Home / Admin / Download Details Featured Image
Duplicate Snippet

Embed Snippet on Your Site

Download Details Featured Image

Add the featured image to output of Download Details widget

Code Preview
php
<?php
function sd_edd_download_details_widget_thumbnail( $instance ) {
	$download_id = isset( $instance['download_id'] ) ? $instance['download_id'] : 0;
	if ( 'current' === $instance['display_type'] ) {
		$download_id = get_the_ID();
	}
	if ( empty( $download_id ) || ! has_post_thumbnail( $download_id ) || 'download' !== get_post_type( $download_id ) ) {
		return;
	}
	echo get_the_post_thumbnail( $download_id );
}
add_action( 'edd_product_details_widget_before_purchase_button', 'sd_edd_download_details_widget_thumbnail' );

Comments

Add a Comment