[cfgeo]

[cfgeo]
[cfgeo]The Content (accepts HTML)[/cfgeo]

The standard Geo Controller shortcode is used to retrieve geo information and manipulate content based on the visitor’s location.

Parameters

return – (accepts: text) – Defines which geo information will be returned. Available return options are:

  • ip
  • ip_version
  • ip_number
  • ip_server
  • ip_dns_host
  • ip_dns_provider
  • isp
  • isp_organization
  • isp_as
  • isp_asname
  • is_local_server
  • continent
  • continent_code
  • country
  • country_code
  • country_code_3
  • country_code_numeric
  • region
  • region_code
  • district
  • city
  • postcode
  • address
  • is_eu
  • calling_code
  • latitude
  • longitude
  • timezone
  • timezone_offset
  • timezone_abbreviation
  • timestamp
  • timestamp_readable
  • current_date
  • current_time
  • currency
  • currency_symbol
  • currency_converter
  • base_convert
  • base_convert_symbol
  • is_vat
  • vat_rate
  • browser
  • browser_version
  • platform
  • is_mobile
  • is_proxy
  • is_spam
  • is_tor
  • limited
  • gps
  • error
  • runtime
  • status
  • official_url
  • credit
  • version

exclude – (accepts: comma-separated text) – Hides content for specified locations (continent, country, region, city name or code). If the visitor’s location matches, the content will be hidden. Otherwise, it will be shown.

include – (accepts: comma-separated text) – Displays content only for specified locations (continent, country, region, city name or code). If the visitor’s location doesn’t match, the content will be hidden.

default – (accepts: text) – Content to display if geo data is unavailable or if include/exclude conditions are not met.

cache – (no value) – Enables caching via AJAX for accurate geo data detection. This attribute is automatically added when caching is enabled in plugin settings.

  • NOTE: In some cases, caching may not work with include/exclude logic.
  • SOLUTION: If include/exclude fails, we recommend using the Geo Banner shortcode instead.

ip – (accepts: IP address v4 or v6) – Optional parameter for testing or debugging. Use it to retrieve geo data for a specific IP. Each use of this attribute will consume a lookup unless you’re using an unlimited license.

Return

If no attributes are set, the shortcode returns the visitor’s IP address. If parameters are defined, it returns the corresponding geo data or conditionally displays content based on location.

Deprecated Shortcodes

Over the years, some shortcodes have been renamed or replaced. The following deprecated shortcode is still supported but may be removed in future versions:

  • [cf_geo]

Examples

Return current visitor’s IP address:

[cfgeo]

Return only city name:

[cfgeo return="city"]

Use in sentence:

We just found shoes in [cfgeo return="city"] that you can buy for 50% discount.

Return area code for a custom IP:

[cfgeo ip="11.23.176.12" return="area_code"]

Exclude content from specific location:

[cfgeo exclude="Toronto"]This text is visible to everyone except visitors from Toronto.[/cfgeo]

Include content for specific locations:

[cfgeo include="New York, DE"]This text is visible only to users from New York and Germany (DE).[/cfgeo]

Experimental BETA Shortcode

[geo]

This is an experimental version of the main shortcode. It functions identically to [cfgeo], but is provided as an alternative in case of conflicts with other plugins. It may eventually replace the default shortcode in future versions.

Was this page helpful?