If-So allows you to easily display the visitor’s county flag (image or emoji) using a simple DKI shortcode. The user location is detected based on the user IP.
To use the Flags DKI Shortcode, you need to install the If-So Geolocation extension, which is available for free.
Below is the shortcode that displays the flags above:
[ifsoDKI type='geo' show='flag' width='50px']
The Flags DKI Shortcode is fully compatible with page caching, regardless of which caching plugin or solution you are using on your website.
If you are using page caching, you can ensure that the Flags DKI Shortcode is dynamically refreshed by adding the ‘ajax=’yes” parameter to the DKI shortcode. This parameter causes the shortcode to be rendered after the rest of the page is loaded from the cache, ensuring that the correct country flag is displayed to each visitor.
[ifsoDKI ajax='yes' type='geo' show='flag' width='200px']
To display an emoji of the visitor’s country flag, use the shortcode below:
Please note that this feature depends on the visitor’s browser being able to display flag emojis. While most modern browsers support flag emojis, some older browsers (such as desktop versions of Chrome) do not. In cases where flag emojis are not supported, the shortcode will display the country ISO code instead.🇺🇸
[ifsoDKI type='geo' show='emoji-flag']