[WordPress] 外掛分享: Download Count for WooCommerce

首頁外掛目錄 › Download Count for WooCommerce
20+
安裝啟用
尚無評分
113 天前
最後更新
問題解決
WordPress 4.6+ PHP 8.0+ v1.21 上架:2020-10-19

內容簡介

顯示顧客下載產品的次數。

產品

下載次數顯示於產品價格下方。
次數為下載總數。

產品後台面板

下載次數顯示於後台管理頁面中的「全部產品」頁面中的「下載次數」欄位。
次數為下載總數。

訂單後台面板

下載次數顯示於後台管理頁面中的「訂單」頁面中的「產品: 下載次數」欄位。
次數會依照產品 ID 和訂單 ID 進行刪選。

選項

提供一個「僅在管理畫面顯示」的選項,可以從管理畫面中設置。

篩選器

提供一個下載次數 HTML 的產品篩選器。

篩選器範例

修改「全部產品」的 HTML。

/** ==================================================
* Download Count for WooCommerce
*
* download_count_woo
* @param string $html html.
* @param int $count count.
*/
function download_countproduct( $html, $count ) {

$html = '<br /><span style="color: green;">' . $count . ' ' . __( 'Downloads', 'woocommerce' ) . '</span>';

return $html;

}
add_filter( 'download_count_woo', 'download_countproduct', 10, 2 );

修改產品 ID 為 331 的 HTML。

/** ==================================================
* Download Count for WooCommerce
*
* download_count_woo_
* @param string $html html.
* @param int $count count.
*/
function download_countproduct_331( $html, $count ) {

$html = '<br /><span style="color: red;">' . $count . ' ' . __( 'Downloads', 'woocommerce' ) . '</span>';

return $html;

}
add_filter( 'download_count_woo_331', 'download_countproduct_331', 10, 2 );

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.21) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Download Count for WooCommerce」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

Displays the number of products downloaded by customers.
Products

The download count is displayed below the price of the product.
The count is the total number of products downloaded.

Admin panel for products

The download count is displayed in the “Downloads” column of the “All products” page in the admin page.
The count is the total number of products downloaded.

Admin panel for orders

The download count is displayed in the “Products : Downloads” column of the “Orders” page in the admin page.
The count will be narrowed down by the product id and order id.

Option

There is an option to “Displayed on the administration screen only”, which can be set from the management screen.

Filter

Provide a filter to download count html for product.

Filter sample

Modifies the HTML for All Products.

/** ==================================================
* Download Count for WooCommerce
*
* download_count_woo
* @param string $html html.
* @param int $count count.
*/
function download_countproduct( $html, $count ) {

$html = '
' . $count . ' ' . __( 'Downloads', 'woocommerce' ) . '';

return $html;

}
add_filter( 'download_count_woo', 'download_countproduct', 10, 2 );

Modifies the HTML for Product ID 331.

/** ==================================================
* Download Count for WooCommerce
*
* download_count_woo_
* @param string $html html.
* @param int $count count.
*/
function download_countproduct_331( $html, $count ) {

$html = '
' . $count . ' ' . __( 'Downloads', 'woocommerce' ) . '';

return $html;

}
add_filter( 'download_count_woo_331', 'download_countproduct_331', 10, 2 );

延伸相關外掛

文章
Filter
Apply Filters
Mastodon