Use these simple Geolocation DKI shortcodes to insert the user’s location: country, city, state, continent, or time zone.
Example:
People in Unknown love If-So!
The country name in the above example is automatically displayed using the Country DKI Shortcode. Your location is detected using our IP-to-location service.
Insert the user’s country
[ifsoDKI type='geo' show='country' fallback='']
*Add ajax=’yes’ if you are using page caching
Insert the user’s state
[ifsoDKI type='geo' show='state' fallback='']
*Add ajax=’yes’ if you are using page caching
Insert the user’s city
[ifsoDKI type='geo' show='city' fallback='']
*Add ajax=’yes’ if you are using page caching
Insert the user’s continent
[ifsoDKI type='geo' show='continent' fallback='']
*Add ajax=’yes’ if you are using page caching
Insert the user’s timezone
[ifsoDKI type='geo' show='timezone' fallback='']
*Add ajax=’yes’ if you are using page caching
Insert the user’s country flag
The country flag DKI shortcode requires the If-So Geolocation Extension to work.
[ifsoDKI type='geo' show='flag' width='50px' classname='class-you-choose']
*Add ajax=’yes’ if you are using page cache. The ‘classname’ parameter is optional. You can include it if you want to assign a CSS class to the flag element.
** Please note that IP-to-location services are not 100% accurate. The accuracy changes between different countries, ISPs, devices, and other factors. Learn more.
If you are using cache on your site then, in practice, users are being served with a “snapshot ” of the page. For the DKI shortcodes to work in such cases, we offer an option to load dynamic content using a separate Ajax request after the page loads from the cache.
To load the DKI shortcode using Ajax, add the parameter ajax=”yes” to the DKI shortcode. For example:
[ifsoDKI type='geo' show='country' ajax='yes' fallback='']
By default, the Geolocation DKI shortcode will not display anything if a value is not returned (usually if you run out of sessions or in rare cases in which the user’s IP is not recognized). To display a fallback value, simply add the parameter fallback=”something” to the shortcode. For example:
[ifsoDKI type='geo' show='country' fallback='something']
The DKI shortcode retrieves values directly from our IP-to-location database and is limited to displaying location names in English. However, our CSV extension offers a solution:
1. Ensure the CSV extension is installed on your site.
2. Download our “All-countries” CSV file (click to download).
3. Insert the desired language’s location names in column D.
4. On your WP dashboard, create a new bulk with a geolocation condition and upload the file.
5. Paste the CSV shortcode, displaying values from column D, wherever you want to show the country name on your page.