[WordPress] 外掛分享: Advanced Custom Fields: Multiple Coordinates

首頁外掛目錄 › Advanced Custom Fields: Multiple Coordinates
WordPress 外掛 Advanced Custom Fields: Multiple Coordinates 的封面圖片
10+
安裝啟用
★★☆☆☆
2.3/5 分(4 則評價)
8 天前
最後更新
問題解決
WordPress 5.0+ PHP 7.0+ v1.0.4 上架:2013-10-23

內容簡介

這個外掛是由Stupid Studio修改延伸出來的「進階自訂欄位:座標」版本,可於此處找到:
https://wordpress.org/plugins/advanced-custom-fields-coordinates/

本軟體採用GNU通用公共授權條款第3版進行授權。有關詳細內容,請參見附帶於本軟體中的gpl.txt檔案。

此外掛程式相依於Google Maps API,不使用API金鑰,因此在符合免費Google Maps API限制下操作,對於大部分的後端使用需求應該是足夠的。

使用方法

當您使用ACF(進階自訂欄位)建立新的自訂欄位時,將欄位類型設定為多重座標地圖。現在當您編輯帶有自訂欄位的文章時,座標選擇工具應該會顯示出來。

此工具在每次點擊地圖時新增一個點,若要移除該點,請選擇「移除座標」按鈕並點擊點。您也可以使用「在地圖上顯示範圍」按鈕以多邊形的方式在地圖上顯示點,並且使用「顯示座標」按鈕以分號分隔的清單形式來顯示實際座標。搜尋欄位僅提供快速尋找地圖上不同的地方,並不用於新增實際座標點。

為了在前端獲取座標資料,只需請求欄位值,並將座標以緯度、經度的陣列形式加以回傳,同時也可取得所在的縮放大小,如以下範例。

<?php
$values = get_field('*****FIELD_NAME*****');
print_r($values);
/* 您將會獲得像以下範例一樣的陣列
Array
(
[coords] => Array
(
[0] => Array
(
[lat] => 57.156363766336
[lng] => 16.364327427978
)
[1] => Array
(
[lat] => 57.159612809986
[lng] => 16.370315551758
)
)
[zoom] => 13
)
*/
?>

外掛標籤

開發者團隊

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

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

原文外掛簡介

A multi-point Google Maps field for Advanced Custom Fields. Click to add markers, drag to reposition, right-click to remove.
The plugin reads your existing Google Maps API key from ACF’s global setting (google_api_key), so no extra configuration is needed if you already use ACF Map fields. If you don’t have one set, you can also provide a key via the acf_multi_coords_gmaps_key filter.
Originally inspired by the single-point ACF: Coordinates field by Stupid Studio; this plugin extends the idea to multiple points per field.
Licensed under the GNU General Public License v3. See gpl.txt for details.
Usage
When you create a new custom field with ACF, set the field type to Multiple Coordinates map. The coordinates chooser will then show up when you edit a post with your custom fields.
The tool adds a point on each click on the map. To remove the point, select the “Remove Coordinate” button and click a point. You can also show the points as a polygon on the map with the “Show area on map” button, and show the actual coordinates in a semicolon-separated list with the “Show coordinates” button. The search field is only there to quickly take you to different places on the map — not to add the actual points.
To get the coordinates data on your frontend, simply request the field value and you get the coordinates in a latitude/longitude array plus the zoom level, like this:
Array
(
[0] => Array
(
[lat] => 57.156363766336
[lng] => 16.364327427978
)
[1] => Array
(
[lat] => 57.159612809986
[lng] => 16.370315551758
)
)
[zoom] => 13
)
*/
?>

延伸相關外掛

文章
Filter
Mastodon