內容簡介
這個外掛可以透過 IP 位置辨識訪客的所在地並根據國家顯示或隱藏特定內容。
自訂欄位
在文章編輯頁面的自訂欄位中,填入“隱藏於”欄位即可將文章隱藏於特定的國家。這樣該文章就不會出現在網站的其他部分。
短代碼
國家
此外掛最基本的短代碼是 [geolocator],它會顯示訪客所在的國家。
顯示
你可以使用 [geolocator_show] 短代碼在特定國家顯示特定內容。請見以下範例。
[geolocator_show for="US"]This information is being shown to visitors from United States only.[/geolocator_show]
此短代碼接受“for”屬性,應該填寫你想顯示內容的國家的兩位字母 ISO 代碼。
隱藏
你可以使用 [geolocator_hide] 短代碼在特定國家隱藏特定內容。請見以下範例。
[geolocator_hide for="US"]This information is NOT being shown to visitors from United States.[/geolocator_hide]
此短代碼接受“for”屬性,應該填寫你想隱藏內容的國家的兩位字母 ISO 代碼。
小工具
Geolocator 的小工具可以顯示訪客的國家,你也可以選擇自訂文字。
鳴謝
本外掛使用由 MaxMind 創建的 GeoLite2 資料,可從http://www.maxmind.com取得。
外掛標籤
開發者團隊
原文外掛簡介
Get website visitor’s location based on IP address and show/hide specific content depending on country.
Meta box
You can hide post for particular country by filling “Hide for” field in custom meta box in post’s edit screen. That way the post will not be included to the loop and other parts of the website.
Shortcodes
Country
The most basic shortcode of the plugin is [geolocator] which displays country of the visitor.
Show
You can show some specific content for particular country by using [geolocator_show] shortcode. See example below.
[geolocator_show for="US"]This information is being shown to visitors from United States only.[/geolocator_show]
The shortcode accepts “for” attribute. It should be a 2-letter ISO code of the country you want to show the content for.
Hide
You can hide some specific content for particular country by using [geolocator_hide] shortcode. See example below.
[geolocator_hide for="US"]This information is NOT being shown to visitors from United States.[/geolocator_hide]
The shortcode accepts “for” attribute. It should be a 2-letter ISO code of the country you want to hide the content for.
Widget
You can display country of the visitor by using Geolocator’s widget. It allows you to choose a custom text.
Credits
This plugin includes GeoLite2 data created by MaxMind, available from http://www.maxmind.com.
