
內容簡介
此外掛需要Easy Digital Downloads。此外掛針對需要顯示精選下載清單的開發人員/用戶設計。
提供了一個範本標籤,可精確地將精選下載清單放置於主題中。
提供了一個簡便的短碼,只要添加「featured」屬性即可列出所有的精選下載清單,不需要輸入任何 ID。
在 WordPress 管理介面提供了一個簡單的界面來管理精選下載清單。在每個下載編輯/發佈頁面以及快速編輯方塊中都將添加「功能下載」核取方塊。從主要下載列表中一目了然地看到哪些下載已在您的網站上精選。
短碼用法
只需添加「featured」屬性到由 Easy Digital Downloads 提供的現有 [downloads] 短碼內:
[downloads featured="yes"]
範本標籤用法
您可以在主題的任何位置顯示精選下載清單,以下代碼可供使用:
echo do_shortcode( '[downloads featured="yes"]' );
您可以包含[downloads]短碼所支援的其他屬性。
建立自己的查詢
要使用WP_Query建立自己的查詢,可以使用值為「edd_feature_download」的meta_key參數。以下示例使用無序列表建立所有精選下載的清單。
<?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(); ?>
外掛標籤
開發者團隊
② 後台搜尋「Easy Digital Downloads Featured Downloads」→ 直接安裝(推薦)
原文外掛簡介
Featured Downloads is now part of EDD Core
As of Easy Digital Downloads 3.5.1, the Featured Downloads addon is included in Easy Digital Downloads. You no longer need this addon to use the Featured Downloads feature.
About this Addon
This plugin requires Easy Digital Downloads. It’s aimed at developers/clients who need to show a list of featured downloads.
Provides a template tag so finely-tuned placement of featured downloads in your theme is possible.
Provides a shortcode which will simply list all the featured downloads, without the need to enter any IDs.
Provides a simple interface for managing featured downloads in the WordPress admin. A “feature download” checkbox will be added to each download edit/publish screen as well as the quick edit boxes. At a glance you’ll also be able to see which downloads have been featured on your website from the main download listing.
Shortcode Usage
Add the “featured” attribute to the existing [downloads] shortcode provided by Easy Digital Downloads:
[downloads featured="yes"]
Template Tag Usage
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.
Building your own Query
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.
'download',
'meta_key' => 'edd_feature_download',
);
$featured_downloads = new WP_Query( $args );
if( $featured_downloads->have_posts() ) : ?>
