[WordPress] 外掛分享: ACF Media Credit

首頁外掛目錄 › ACF Media Credit
100+
安裝啟用
★★★★★
5/5 分(3 則評價)
2906 天前
最後更新
問題解決
WordPress 4.0+ v2.3.7 上架:2014-12-15

內容簡介

此外掛使用 Advanced Custom Fields 的 Repeater 欄位,為您的媒體庫中的每個項目添加「作者」和「作者連結」選項。目前僅會對前端顯示的圖片進行設置和顯示。本外掛不支援 .pdf 檔案、.swf 檔案、.doc 檔案等的作者聲明。

必須使用 Advanced Custom Fields Pro 或是有 免費版 ACF 以及 Repeater Field 外掛的其中之一。

我建議與此外掛搭配使用 ACF Pro。

ACF 欄位會被匯出成 json 檔案(供 ACF Pro 使用),此檔案會存在此外掛的 ‘acf_exports’ 資料夾中。
如果你無法正常載入這些欄位,可以透過 ACF Pro 的匯入功能匯入該 json 檔案。

如果你是一位開發者,本外掛對你開放了一些功能(詳見:dongaines.com/acf-media-credit)。

在 ‘/inc/’ 資料夾中,這些欄位已經被匯出成 PHP,可供 ACF Pro 或 ACF 免費版使用。

功能

以下是可以使用的少數功能。這些功能的更多解釋可參見 dongaines.com/acf-media-credit。可使用的功能有:
the_post_thumbnail_media_credit(); //不需要附件 ID
the_media_credit_html($attachment_id); //回傳 HTML
the_media_credit($attachment_id); //輸出 the_media_credit_html();
the_plain_media_credit($attachment_id); //輸出最基本的標記
print_r(get_media_credit($attachment_id)); //有助於除錯

對於帶有標題的圖片,我會過濾標題縮略語碼,如果您需要進行更改也必須這麼做:add_filter( 'img_caption_shortcode', 'your_function_name', 10, 3 );

新增了一些過濾器:
add_filter(‘acf_media_credit_base_output’, ‘your_function_name’); //your_function_name($image_credit)
add_filter(‘acf_media_credit_div_class’, ‘your_function_name’); //your_function_name($media_credit_div_class)

外掛標籤

開發者團隊

⬇ 下載最新版 (v2.3.7) 或搜尋安裝

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

原文外掛簡介

This plugin uses the Repeater field of Advanced Custom Fields to add options for a Credit and Credit Link on each item in your Media Library. Currently this will only correlate and display for IMAGES on the front end. This does not support credits for .pdf files, .swf files, .doc files, etc.
Requires either Advanced Custom Fields Pro or the free version of ACF with the Repeater Field add-on.
I suggest using ACF Pro with this plugin.
ACF Fields are exported as a json file (for ACF Pro) in the ‘acf_exports’ directory of this plugin.
ACF Pro allows you to import that json file if for some reason you’re having trouble getting the fields to load.
If you’re a developer there are functions available to you (see: dongaines.com/acf-media-credit)
In the ‘/inc/’ directory the fields have been exported as PHP to work w/ ACF Pro or ACF free
Functions
There are a handful of functions available for your use and there is more explanation given to them at dongaines.com/acf-media-credit. The functions available:
the_post_thumbnail_media_credit(); //does not require an attachment id
the_media_credit_html($attachment_id); //returns
the_media_credit($attachment_id); //echos the_media_credit_html();
the_plain_media_credit($attachment_id); //outputs the most basic markup
print_r(get_media_credit($attachment_id)); //helpful for debugging
For images with a caption I’m filtering the caption shortcode, please do the same if you need to make a change: add_filter( 'img_caption_shortcode', 'your_function_name', 10, 3 );
Added filters:
add_filter(‘acf_media_credit_base_output’, ‘your_function_name’); //your_function_name($image_credit)
add_filter(‘acf_media_credit_div_class’, ‘your_function_name’); //your_function_name($media_credit_div_class)

延伸相關外掛

文章
Filter
Apply Filters
Mastodon