
內容簡介
此外掛需要 Easy Digital Downloads v2.5 或更新的版本。這個外掛可讓您為您的下載商品新增額外圖片。使用內含的短碼或範本標籤在您的網站上顯示這些圖片。開發者也可以使用此外掛程式取得圖片陣列,並以任何方式顯示這些圖片 (例如,幻燈片)。
使用短碼
[edd_download_images]
使用範本標籤
if( function_exists( 'edd_di_display_images') ) {
edd_di_display_images();
}
過濾 HTML
要更改 HTML,提供以下範例過濾器 (例如在圖片周圍添加額外的 <div>)。將其貼上到您的 functions.php 中,並修改 $html 方式:
function themename_edd_di_display_images( $html, $download_image ) {
// 這裡每個圖片周圍會包裝成 div 標籤
$html = '<div><img class="edd-di-image" src="' . $download_image['image'] . '" /></div>';
return $html;
}
add_filter( 'edd_di_display_images', 'themename_edd_di_display_images', 10, 2 );
開發者
您可以使用以下方式從資料庫中取得圖片的陣列。如果您想建立一個幻燈片來顯示所有下載商品的圖片,這很有用:
$images = ( function_exists('edd_di_get_images') ) ? edd_di_get_images() : '';
// 在清單中看到圖片
var_dump( $images );
相關 Easy Digital Downloads 外掛程式
https://easydigitaldownloads.com/extensions/
外掛標籤
開發者團隊
原文外掛簡介
This plugin requires Easy Digital Downloads v2.5 or higher. This plugin allows you to add extra images to your downloads. Use the included shortcode or template tag to display the images on your website. Developers can also use this plugin to get an array of the images and display the images any way they wish (eg slideshow).
Shortcode Usage
[edd_download_images]
Template Tag Usage
if( function_exists( 'edd_di_display_images') ) {
edd_di_display_images();
}
Filtering the HTML
To alter the HTML, the following filter is provided (example shows an extra
function themename_edd_di_display_images( $html, $download_image ) {
// here a div tag is wrapped around each image
$html = '
';
return $html;
}
add_filter( 'edd_di_display_images', 'themename_edd_di_display_images', 10, 2 );
Developers
To get the array of images from the Database you can use the following. This will be useful if you’d like to build a slideshow to show all the download’s images:
$images = ( function_exists('edd_di_get_images') ) ? edd_di_get_images() : '';
// see the images in the array
var_dump( $images );
Plugins for Easy Digital Downloads
https://easydigitaldownloads.com/extensions/
