Skip to content

Shortcodes

Maki Geo provides several shortcodes for both displaying location information and creating geo-targeted content.

Location Display Shortcodes

Display visitor location information anywhere in your content.

Country Flag

[mgeo_country_flag size="24px"]

Displays the visitor’s country flag. Optional size parameter controls the flag size.

Country Name

[mgeo_country default="Unknown"]

Displays the visitor’s country name. Optional default parameter sets fallback text.

Region/State

[mgeo_region default="Unknown"]

Shows the visitor’s region, state, or province. Optional default parameter sets fallback text.

City

[mgeo_city default="Unknown"]

Shows the visitor’s city name. Optional default parameter sets fallback text.

Continent

[mgeo_continent default="Unknown"]

Shows the visitor’s continent. Optional default parameter sets fallback text.

Geo Content Shortcode

Create geo-targeted content using the [mgeo_content] shortcode.

Basic Usage

[mgeo_content country="United States"]
Content for US visitors
[/mgeo_content]

Options

AttributeValuesExplanationExample value
continentEnglish name(s) of continent(s)The continent(s) to match the rule on.Africa,Europe
countryEnglish name(s) of country/countries.The country/countries to match the rule on.United States,Mexico
regionEnglish name(s) of the region(s).The region(s) to match the rule on. For most countries, these are the names of states or provinces.Alabama,Champagne
cityEnglish name(s) of the city/cities.The city/cities to match the rule on.New York,Mumbai
ipIP address(es).The ip address(es) to match the rule on.127.0.0.1,103.21.244.0
match”all” (default) or “any”.How the conditions should be matched. For “all” all conditions have to be met. For “any”, just one of the conditions has to be metany
action”show” (default) or “hide”.“show” will show the block contents when the conditions are met and hide them when the conditions aren’t met. “hide”, whill hide the block contents when the conditions are met and show them when the conditions aren’t met.127.0.0.1,103.21.244.0

Multiple Conditions

[mgeo_content country="United Kingdom" city="London"]
Content for visitors from the city London in the UK
[/mgeo_content]

Note that the above example shows the content to visitors from the city London in the UK (so not London, Ontario, for example).

Multiple Values

[mgeo_content country="France,Germany,Italy" match="any"]
Content for selected European countries
[/mgeo_content]

Exclusion Rules

[mgeo_content country="!China"]
Content for visitors outside China
[/mgeo_content]

Hiding instead of showing

[mgeo_content action="hide" country="Mexico"]
Content is hidden from visitors from Mexico, but shown to everyone else
[/mgeo_content]

Nesting shortcodes for additional rules (advanced)

You can put shortcodes inside of shortcodes to create even more complex rules. For example:

[mgeo_content country="US,Canada" match="any"]
[mgeo_content region="Quebec" action="hide"]
Content for US visitors or Canadian visitors outside Quebec
[/mgeo_content]
[/mgeo_content]

Best Practices

  1. Provide default values for location display shortcodes
  2. Keep targeting rules simple and logical
  3. Test your shortcodes with different locations