前言介紹
- 這款 WordPress 外掛「ACF Photo Gallery Field」是 2016-07-01 上架。
- 目前有 60000 個安裝啟用數。
- 上一次更新是 2025-01-10,距離現在已有 113 天。
- 外掛最低要求 WordPress 5.8 以上版本才可以安裝。
- 外掛要求網站主機運作至少需要 PHP 版本 7.0 以上。
- 有 28 人給過評分。
- 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。
外掛協作開發者
navzme |
外掛標籤
acf | photo | custom | fields | gallery |
內容簡介
t; 'Status',
'name' => 'status',
'choices' => array(
'public' => 'Public',
'private' => 'Private',
),
'value' => get_field($field . '_status', $attachment_id)
);
return $args;
}
add_filter('acf_photo_gallery_attachment_field_args', 'my_extra_gallery_fields', 10, 3);
After adding this function, you can now access the extra fields (Alt and Status) in your gallery loop example code.
If you require any assistance or want to contribute, please visit the support forum on Github.
原文外掛簡介
Important Notice for New Users of ACF Photo Gallery Field
If you are installing the ACF Photo Gallery Field for the first time on your WordPress website, we’d like to inform you that this plugin will no longer be maintained as of October 2024. As an alternative, we have launched a new and improved plugin called ACF Galerie 4.
We encourage you to check out ACF Galerie 4 for enhanced features and ongoing support. ACF Galerie 4 includes a built-in migration tool that seamlessly transfers data from ACF Photo Gallery Field or ACF Gallery Pro to ACF Galerie 4. Learn more.
Thanks
A lightweight extension of Advanced Custom Field (ACF) that adds Photo Gallery field to any post/pages on your WordPress website.
Visually create your Fields
Add multiple photos and you can also modify title, caption and link to anything
Assign your fields to multiple edit pages (via custom location rules)
Easily load data through a simple and friendly API
Uses the native WordPress custom post type for ease of use and fast processing
Uses the native WordPress metadata for ease of use and fast processing
Supports WordPress classic and Gutenberg editor
RESTFul API
Donation
Navneil Naicker is the sole developer working on this free WordPress Plugin in his leisure time. He would like to integrate it with premium plugins like Elementor Pro and Advanced Custom Fields Pro. Please donate to support Navneil in continuing further development of this plugin. Click on the link “https://www.buymeacoffee.com/navzme” to donate.
Usage
acf_photo_gallery is a helper function that takes in ACF_FIELD_NAME and POST_ID will query the database and compile the images for you. The output of this function will be an array.
acf_photo_gallery(ACF_FIELD_NAME, POST_ID);
Example
The following example is using Twitter Bootstrap framework to layout. You can use any framework of your choice.
ID);
//Check if return array has anything in it
if( count($images) ):
//Cool, we got some data so now let's loop over it
foreach($images as $image):
$id = $image['id']; // The attachment id of the media
$title = $image['title']; //The title
$caption= $image['caption']; //The caption
$full_image_url= $image['full_image_url']; //Full size image url
$full_image_url = acf_photo_gallery_resize_image($full_image_url, 262, 160); //Resized size to 262px width by 160px height image url
$thumbnail_image_url= $image['thumbnail_image_url']; //Get the thumbnail size image url 150px by 150px
$url= $image['url']; //Goto any link when clicked
$target= $image['target']; //Open normal or new tab
$alt = get_field('photo_gallery_alt', $id); //Get the alt which is a extra field (See below how to add extra fields)
$class = get_field('photo_gallery_class', $id); //Get the class which is a extra field (See below how to add extra fields)
?>
Add Extra Fields
To add extra fields add the following to your themes functions.php file.
//Create extra fields called Altnative Text and Status
function my_extra_gallery_fields( $args, $attachment_id, $acf_key ){
$args['alt'] = array(
'type' => 'text',
'label' => 'Altnative Text',
'name' => 'alt',
'value' => get_field($field . '_alt', $attachment_id)
);
$args['status'] = array(
'type' => 'select',
'label' => 'Status',
'name' => 'status',
'value' => array(
array(
'1' => 'Active',
'2' => 'Inactive'
),
get_field($field . '_status', $attachment_id)
)
);
return $args;
}
add_filter( 'acf_photo_gallery_image_fields', 'my_extra_gallery_fields', 10, 3 );
Supported field types:
* text, date, color, datetime-local, email, number, tel, time, url, week, range, checkbox, radio, textarea, select
How to get values of extra fields
You can use ACF helper function get_field
get_field('photo_gallery_alt', $id);
get_field('photo_gallery_class', $id);
Pull caption from attachment caption field
By default the caption is being pulled from description field. Add the following filter to your function.php to pull the caption from attachment caption field.
add_filter( 'acf_photo_gallery_caption_from_attachment', '__return_true' );
REST API
Send HTTP Request to URL to get JSON response of all posts
http://{domain}/wp-json/wp/v2/{POST_TYPE}/
Send HTTP Request to URL to get JSON response of specific post
http://{domain}/wp-json/wp/v2/{POST_TYPE}/{POST_ID}/
When you receive the response, see the ACF item which contains ACF photo gallery name and array of images.
Installation and basic usage tutorial
ACF Photo Gallery Field on WordPress Custom Post Type tutorial
How to use Elementor dynamic tags with ACF Photo Gallery Field plugin tutorial
Compatibility
This ACF field type is compatible with: ACF 4, 5 and 6
Issues
Just like any other WordPress plugin, this plugin can also cause issues with other themes and plugins. If you are facing issues making this plugin work on your WordPress site, please do ask for help in the support forum. This way we can help you out and prevent this issue from happening to someone else. If you want to talk to me directly, you can contact me via my website http://www.navz.me/
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「ACF Photo Gallery Field」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
1.9 | 2.0 | 2.1 | 2.2 | 2.3 | 2.4 | 2.5 | 2.6 | 2.7 | 2.8 | 2.9 | 3.0 | 1.6.2 | 1.6.3 | 1.6.4 | 1.6.5 | 1.6.6 | 1.6.7 | 1.6.8 | 1.6.9 | 1.7.1 | 1.7.6 | 1.7.7 | 1.7.8 | 1.7.9 | 1.8.0 | 1.8.1 | trunk |
延伸相關外掛(你可能也想知道)
Advanced Custom Fields (ACF®) 》Advanced Custom Fields 可以讓 WordPress 網站成為一個完整的內容管理系統,提供您所有工具以更好管理您的數據。, 使用 Advanced Custom Fields 外掛,完全...。
CMB2 》CMB2 是一個開發人員的工具包,用於在 WordPress 上構建 metabox,自定義字段和表單,可以讓您震撼。輕鬆管理帖子、條款、用戶、評論的元數據,或創建自定義...。
Advanced Custom Fields: Extended 》🚀 全方位增強套件,可改進WordPress和Advanced Custom Fields。此外掛旨在提供一個強大的管理框架,涵蓋了眾多改進和優化。, 此外掛需要至少 ACF Pro 5.8。,...。
Dynamic Conditions 》Dynamic Conditions 是一個 Elementor 外掛,加入了條件邏輯來顯示或隱藏不同元素。該外掛將條件添加到動態標籤中,以顯示/隱藏小工具或區塊。, 此外掛需要 E...。
Custom Field Suite 》Custom Field Suite (CFS) 讓您為文章添加自定義欄位。它輕量級且經過過往使用者的測試(很難出現錯誤)。, 需要了解的事項, , 我們不提供支援。, 這是一個免...。
Custom Field Template 》「Custom Field Template 外掛」在「編寫文章/頁面」時,新增自訂欄位的預設設定。這個模板格式基本上跟「rc:custom_field_gui 外掛」差不多,不同處在於:, ...。
Custom Block Builder – Lazy Blocks 》WordPress 自訂區塊外掛程式, ★★★★★, 開發商使用於 WordPress 自訂區塊的魔法棒。我們創建了 Lazy Blocks WordPress 外掛程式,協助每位開發商取得他們需要的...。
Secure Custom Fields 》總結:SCF 是一款能夠擴展 WordPress 功能的外掛,使其成為一個靈活的內容管理工具。透過 SCF,管理自定義數據變得簡單高效。, , 1. 為什麼 SCF 是一個靈活的...。
Genesis Custom Blocks 》Genesis Custom Blocks 為 WordPress 開發人員提供了必要的工具,以應對現代 WordPress 「區塊先行」的實境。, WordPress 區塊編輯器(又稱 Gutenberg)為我...。
Product Input Fields for WooCommerce 》Product Input Fields for WooCommerce 插件可讓您在 WooCommerce 產品的前端添加自定義輸入字段,以供顧客在添加產品到購物車之前填寫。, 可以全域性地(即...。
BuddyPress Xprofile Custom Field Types 》BuddyPress Xprofile Custom Field Types 插件為 BuddyPress 資料檔案新增了一些必要的欄位類型。, BuddyPress Xprofile Custom Field Types 與 BP Profile S...。
PixFields 》使用 PixFields,您可以擁有自訂欄位的視覺化管理工具。, 注意:此外掛不會新增任何樣式至自訂欄位的輸出結果,它僅僅新增了元數據(metadata)並提供了一種覆...。
NextGEN Custom Fields 》這款外掛是為了將自訂欄位加到卓越且受歡迎的 NextGEN Gallery 外掛而開發。只需輸入新欄位的名稱,從「輸入」、「文字區域」或「下拉式選單」中選擇,就會自...。
Just Custom Fields 》Just Custom Fields(即自定義欄位)增加了在文章、頁面(與其他自定義文章類型)和分類中添加附加欄位的功能。安裝後,您將看到一個簡單的設置頁面,易於使...。
Extra User Details 》Extra User Details 是一個簡單的外掛,允許您在使用者個人資料頁面上新增額外的欄位 (例如 Facebook、Twitter、LinkedIn 連結等)。, 您可以像 WordPress 原...。