If your wordpress website receives visits from different countries we may have situations to filter our website contents based on the country from where the user visits. This filtering is now possible for wordpress with a free plugin called Custom Content by Country (by iControlWP). This plugin may also be used for amazon affiliation/associates for different countries.

Custom Contents based on Country

Requirements

1)      Install Custom Content by Country (by iControlWP) in your wordpress site.

2)      Need to import ip2nation in to your wordpress database(follow the instructions).

 

Instructions:

1)      Go to your wordpress dashboard and install this country filtering plugin mentioned above , it will then ask you to install ip2nation(it maps your country based on your IP address) information’s into your database ( don’t worry they will be installed remotely by the plugin if you select OK).

2)      Activate the plugin from its dashboard. If you are using any caching plugin (like W3 Total Cache, WP Super cache) then enable W3TC Compatibility Mode option from the dashboard.

1

dashboard options

3)      This W3TC Compatibility Mode when enable will turn off page caching for pages that use these shortcodes.

4)      This plugin works mainly due to the following shortcodes.

  • [ CBC ]      // important
  • [ CBC_COUNTRY ]
  • [ CBC_IP ]
  • [ CBC_CODE ]
  • [ CBC_AMAZON ]

5)      The shortcode [CBC] will be used for filtering the content based on country.

6)      [CBC] takes 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”

7)      so if you want to display a message say “This will be displayed in India” we will use the following tag

  • [CBC country=”in” show=”y”] This will be displayed in India[/CBC]
2

post with show enabled

3

Preview when show is enabled

 

 

8)      If you want to display a message say “This will be displayed in India” we will use the following tag

  • [CBC country=”in” show=”n “] This will be displayed in India[/CBC]
4

post when show is diasbled

5

preview when show is diasbled

Note:

1)      More information on shortcodes refer plugin FAQ’s page.

2)      The W3TC Compatibility Mode should be enabled.

3)      For country codes visit http://en.wikipedia.org/wiki/ISO_3166-1.

chandan

""

Tips N TricksWordPress Guidewordpress,wordpress guide
 If your wordpress website receives visits from different countries we may have situations to filter our website contents based on the country from where the user visits. This filtering is now possible for wordpress with a free plugin called Custom Content by Country (by iControlWP). This plugin may also...