Plugin Directory

Test out the new Plugin Directory and let us know what you think.

Custom Content by Country (by iControlWP)

Tool for displaying/hiding custom content based on visitors country/location.

What is the Shortcode to use?

[CBC] [/CBC]

What options are available in the shortcode?

Currently there are 4 options/parameters: country, show, message, html

country: a comma-separated list of country codes, e.g. country="us, es, uk"

show: is a simple yes ('y') or no ('n'). e.g. to hide content, show="n"

message: is an optional piece of text you can display when the content that you're showing/hiding from a group of people isn't shown. Instead of displaying absolutely nothing, you can display a message. e.g message="Sorry, this content isn't available in your region."

html: This is the html tag within which the content will be wrapped, e.g. DIV, SPAN, ... If this isn't specified, SPAN is used. If you don't want any HTML wrapping specify html="none"

How do I use the shortcode?

To show the text "abcdefg" ONLY to visitors from the US and France, I would use the following shortcode:

[CBC country="us, fr" show="y"]abcdefg[/CBC]

To then hide the text "mnopqrst" ONLY from visitors in Spain, I would use the following shortcode:

[CBC country="es" show="n"]mnopqrst[/CBC]

What happens if I leave out the option "show"?

Then 'show' will default to 'y' and proceed accordingly.

What happens if I leave out the option "country"

Nothing, it will just print the content to everyone.

What is CloudFlare and how does it relate to this plugin?

If your site isn't using CloudFlare, you really should consider it.

Separately, if you are using it on your site, you have a slight optimization where I use a parameter that CloudFlare sends that gives the users location saving me an SQL query.

Where does the plugin pull its IP location data?

The plugin makes use of the location data provided by IP 2 Nation that is freely available. You don't need to pay for this.

Will this plugin slow my site down by making external queries to 3rd parties?

No. The plugin, upon activation, will ask you to install the necessary data into your own WordPress database. If you don't install this data, you cannot use the plugin.

Where can I find a list of the country codes?

I believe the country codes are ISO 3166 country codes. You can find a list here: http://en.wikipedia.org/wiki/ISO_3166-1

Are the any other shortcodes available in this plugin?

Yes, I have provided 2 extra shortcodes. They are:

[CBC_COUNTRY /] takes no parameters and is used as-is. This will print the visitor's full country name.

[CBC_IP /] takes no parameters and is used as-is. This will print the visitor's full IP address (or their proxy server).

Can I nest shortcodes - i.e. put a shortcode within the custom content?

Yes. I'm still baffled why other plugin authors find this a challenge.

I want to use CSS to style the output, is there way I can do that?

Yes. Again, I'm still baffled why other plugin authors find this a challenge.

Any output from the plugin is wrapped in html SPANs with corresponding classes:

CBC has class 'cbc_content' CBC_COUNTRY has class 'cbc_country' CBC_IP has class 'cbc_ip'

There is also the option within the each shortcode itself to specify ID and STYLE just like you would HTML elements.

e.g. [CBC country="gb" show="y" id="my_cbc_id" style="color:yellow;"]Custom Content for GB[/CBC]

How does the W3 Total Cache option work exactly?

W3 Total Cache allows you to (programmatically) set caching options on a per-page basis. This means we can say for any WordPress page/post that is loaded, to allow caching, or not.

As of version 2.11, I have added the global plugin option to turn off page caching for ONLY those pages that use this shortcode. If you use this shortcode throughout your website using your theme, and you enable this option, you will effectively turn off page caching for your entire site.

Remember this only affects page caching. It doesn't affect any browser caching, database or object caching etc. If you don't know what this means, read the FAQ on the W3 Total Cache plugin for more info.

Do you make any other plugins?

We also created the Manage Multiple WordPress Site Better Tool: iControlWP for people with multiple WordPress sites to manage.

Yes, we created the only Twitter Bootstrap WordPress plugin with over 122,000 downloads so far.

What "country code" can I use to test locally if I'm accessing a server on our network?

If your local network address is defined as "Private" according to the database, the country code to use in this case is: 01

This isn't fully tested and shouldn't be used as-is in production but it seems to hold up. Feedback welcome.

Is there an option to remove the data that was added to the DB by the plugin?

Currently, no (but eventually, yes). You can do so manually by firing up your phpMyAdmin for your site and dropping the following 2 tables:

ip2nation ip2nationCountries

Requires: 3.2.0 or higher
Compatible up to: 4.7.2
Last Updated: 3 months ago
Active Installs: 2,000+


4.9 out of 5 stars


0 of 9 support threads in the last two months have been marked resolved.

Got something to say? Need help?


Not enough data

0 people say it works.
0 people say it's broken.

100,1,1 100,1,1 100,1,1
100,1,1 100,1,1 100,1,1 100,1,1
100,1,1 100,1,1 0,1,0
100,1,1 100,1,1 100,1,1