[WordPress] 外掛分享: Advanced Custom Fields: Image Size Select Field

首頁外掛目錄 › Advanced Custom Fields: Image Size Select Field
300+
安裝啟用
★★★★★
5/5 分(1 則評價)
65 天前
最後更新
問題解決
WordPress 3.6.0+ PHP 7.0+ v1.0.3 上架:2018-11-29

內容簡介

這個外掛可以讓你在 WordPress 控制台中選擇已註冊的圖片尺寸。

相容性

這個 ACF 欄位類型相容於:
* ACF 5

使用方法

啟用之後,這個外掛會在 ACF 中建立一個圖片尺寸欄位類型。這個欄位類型會將所有已註冊的圖片尺寸列在欄位群組中的下拉選單中。

要在自定義模板中使用這個欄位,你需要使用下列程式碼:

$my_image_id = get_field('my_image_id'); // ACF Image 回傳類型設定為 ID,此為示範
$my_image_size = get_field('my_image_size'); // 所選擇的圖片尺寸(例如:large)

echo wp_get_attachment_image( $my_image_id, $my_image_size ); // 基於 ID 和所選的圖片尺寸輸出圖片。

外掛標籤

開發者團隊

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

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Advanced Custom Fields: Image Size Select Field」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

Field to select registered image sizes within the WordPress dashboard.
Compatibility
This ACF field type is compatible with:
* ACF 5
How to Use
Once activated, this plugin will create a Image Size field type in ACF. This field type will list all registered field types as a drop down within the field group.
To use this field within your custom templates you will use the following code:
$my_image_id = get_field('my_image_id'); // ACF Image return type set to ID for this demo
$my_image_size = get_field('my_image_size'); // The selected image size (eg. large)

echo wp_get_attachment_image( $my_image_id, $my_image_size ); // Output the image based on the ID, and the Image Size selected.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon