Using shortcodes

The basics of the Geotargeting plugin is to surround your content with shortcodes.

For example:

[geot_filter country="AR"] Messi is the best! [/geot_filter][geot_filter country="PT"] Cristiano Ronaldo is the best![/geot_filter][geot_filter exclude_country="AR,PT"]We don't like soccer[/geot_filter]

If the user above is from Argentina he will read that “Messi is the best”, while if he is from Portugal we will see “Ronaldo is the best”. Is the user is not from Argentina or Portugal he will see "We don't like soccer".

Good practices

  • Use of iso codes instead of country names. Will be much easier to avoid mistakes or typos in your code.
  • Create regions if you need to use several countries/cities together. You can create Regions in the settings page of the plugin.

You can add shortcodes manually, but it’s easier using the visual editor button. Just press the “world icon” and choose the desired options to generate the shortcode.

Captura de pantalla 2014-12-09 a la(s) 12.32.15

To view full shortcodes options check this page.

Tutorials

We have a great set of resources in our blog, check for example this tutorial

Testing out the plugin

Once you have your shortcodes or functions in place it’s time to test / debug your site. Please refer to debugging page in order to know how to do that.

Check out our WordPress geolocation solutions
to find out everything you can do!

Start your free trial