主要是有兩個東西會需要設定 google api:
- google font
- google map
divi 內使用 google font
如果只是要使用google font,在 divi 內設定google api的話,可以很方便的使用所有google font,會比下載字型檔案後上傳引入的方式好用很多。且若上傳,還得額外去調整php.ini裡面單一檔案上傳的限制調大。
設定方式如下:
- 到 google cloud 新增一個專案
- 啟用「Web Fonts Developer API」
- 建立一個憑證,取得金鑰複製起來,如果只使用字體的話,不用綁信用卡
- 回到wp後台的 Divi Theme Options ,到 General 的 Google API Key 輸入金鑰,並且把Google Fonts Subsets 改成 enabled (這樣才能選同一字體的子集,以中文來說就是不同的粗細)後儲存
- 之後再使用 divi 設定字體的時候,輸入字體名稱(字體名稱要到 google font 去看他的英文,例如思源黑體就是 Noto Sans TC)就可以搜到 google font 的相關字體來使用
divi 內使用 google map
這個主要是使用 google map api 的方式來使用 google map。如果只是使用 iframe 嵌入,不需要額外設定 google api
設定方式如下:
- 到 google cloud 新增一個專案
- 啟用的API:粗斜體這三個我確定一定要開。特別是 Address Validation API ,這個若不開的話,在 divi 裡面的 map 模組想設定地址去標地標就會沒辦法設定。其他是跟map有關的api,我也有開,但不確定哪幾個跟 divi 的 map 模組有關
- Maps JavaScript API
- Geocoding API
- Address Validation API
- Maps Elevation API
- Maps Embed API
- Maps SDK for Android
- Maps SDK for iOS
- Maps Static API
- Places API
- Places API (New)
- Roads API
- Street View Publish API
- Street View Static API
- 建立一個憑證,取得金鑰複製起來,因為要用 map api ,系統會要求綁訂信用卡
- 回到wp後台的 Divi Theme Options ,到 General 的 Google API Key 輸入金鑰
- 之後使用 divi 插入 map 模組的時候,map框框內資料就會正常顯示,輸入地址也可以正常把地點 pin 進去