Welcome visitor from ; work smarter by installing the easy to use CCA Plugin:
In this section:
1. “How to” video
2. Initial site-wide settings. DO THIS FIRST
2a. Using Cloudflare to identify country
3. Sidebar widgets
3a. RSS News Feed content
4. Widgets/Adverts within posts
5. Making widgets smart responsive
6. SHORTCODES – Customizing and personalizing your posts
1. CCA Demo (Part 2 how)
2. Initial Site setup DO THIS FIRST
If you want to enable the “Country” functionality of the plugin: from your Dashboard go to “Settings->Category Country Aware Goodies” and under the General Tab check the “Initialize GeoIP” tick box, then click the “Activate” button at the bottom of the form.
Fig 1: CCA Widget Settings Form (Dashboard->Settings->Catagory Country Aware Goodies)
This step has been added because plugins listed & stored in the WordPress.Org Plugins Directory must be licensed under GPL and this is now being enforced by the WordPress team. The data file to identify the visitor’s country is provided by Maxmind under a Creative Commons license; the WordPress team instructions are that Maxmind data should be installed by the plugin when you (the user) requests it.
Cloudflare:
If you are using Cloudflare as a CDN, you use their servers to do the GeoLocation “look-up”; this will be slightly faster.
Simply switch on geolocation via your Cloudflare dashboard. (instructions on Cloudflare’s site).
3. CCA “Sidebar” widget
Fig 1: CCA Widget Settings Form (Note: RSS functinallity is hidden)
You can use multiple CCA widgets each with their own content. The widget has the same settings as the standard WordPress Text or RSS widgets; additionally:
- It has fields for category and visitor country enabling you to provide different content for different posts and visitors. (Fig 1 above)
- You can use the HTML <br> tag in CCA widget titles. (Fig 1)
- You can specify the number of characters to display for “RSS” news feed items. (Fig 3 below)
- Option to “nofollow” news feed links (SEO benefits) and set links to open in new tabs. (Fig 3)
Note: you must always start off by adding an entry for category “all” / country “any”; this is the default content displayed when there isn’t a more specific and suitable entry to display. If you only want a widget displayed for specific category(s)/country(s) then you can set this default entry to a widget type to “None”.
3a. Adding RSS “functionality” to widgets
The majority of users do not need the RSS option so it is “hidden” by default. To add this functionality to your widgets you need to check the RSS option on the plugins global settings (Dashboard-> Settings-> Category Country Aware Goodies).
Fig 2: CCA plugin site wide settings
CCA widgets will then include an option to allow you to select widget type of Text or RSS for each Category/Country entry (Fig 3 below)
Fig 3: CCA widget with RSS settings
Note: Like the WordPress RSS widget; if you don’t provide a widget title the News Feed provider’s title is displayed for the RSS content.
The CCA widget has the same options as the standard WP RSS widget. Additionally: it allows you to specify the size of the news items summary; and to open RSS links in a new tab and “nofllow” the links (good for SEO).
4. Ads within Posts widget
Dashboard-> Settings-> Category Country Aware Goodies -> “Ads within Posts widget”
Fig 4: Adds within Posts widget
See next section, if you want the content to be displayed on small devices like smartphones ONLY.
5. Making widgets smart responsive
Dashboard-> Settings-> Category Country Aware Goodies -> General
1. Check the “display Responsive option in widgets” checkbox; and save settings (Fig 5 below). The screen will refresh and the settings form will now include a field where you can enter the smart responsive trigger width.
2. Enter the width (Fig 5) at which:
- your sidebar is moved or hidden (responsive themes); or
- you have to scroll right in your browser to see the sidebar (fixed width/fluid themes)
and save settings.
Example :If you shrink your browser window on this site you will see the theme hides the sidebar when your browser width is <= 800 pixels. So I've set the CCA Responsive pixel width trigger at 800px.
Fig 5:Sitewide CCA Smart Responsive settings
3. Your CCA widgets (both sidebar and “in posts”) will now include a smart responsive checkbox. Check this box and save settings on any widget you wish to be smart responsive
Fig 6: “Ads within posts” with smart responsive checkbox
6. Country Aware Shortcodes
- Parameters/values are case insensitive e.g. noT=gb,US,ca, c=-2, CaSe=lOwEr would work.
- LIVE EXAMPLES of these shortcodes are demonstrated in a table below the definitions.
- More shortcodes are provided by the Country Caching Goodies Extension (these will be incorporated in the standard CCA plugin at a later date).
[cca_countryname]: inserts the name of the visitor’s Country
[cca_countrycode]: inserts the visitor’s ISO Country code
[cca_countrycode case=”lower”]: as above but converted to lowercase
[cca_display only=aa,aa]Some section or text…[/cca_display] (where “aa,aa” is one or more comma separated ISO country codes): The content between the [cca_display] tags is only displayed for visitors whose countries are defined by the “only=” parameter.
Note: as well as text/HTML the content can also include javascript and OTHER SHORTCODES
[cca_display not=aa,aa]Some section or paragraph…[/cca_display] (where “aa,aa” is one or more comma separated country codes): The content between the [cca_display] tags is hidden from visitors whose countries are defined by the “not=” parameter.
Note: as well as text/HTML the content can also include javascript and OTHER SHORTCODES
[cca_is_EU]some text/JS/other shortcodes..[/cca_is_EU]
( or [cca_is_eu]text/javascript/shortcodes..[/cca_is_eu] )
The content between the tags is only displayed/included for visitors from countries that are members of the “European Union” (or from a group of countries defined by you).
The “EU Group” can be found in the Countries tab of CCA Settings. By default it is populated with EU Countries (accuracy not guaranteed). You can modify this list as you wish e.g. you can add additional countries that also require compliance with EU GDPR laws.
[cca_not_EU]some text/JS/other shortcodes..[/cca_not_EU]
( or [cca_not_eu]text/javascript/shortcodes..[/cca_not_eu] )
As above except the contents between the tags is only displayed/included for visitors from countries not in the “EU Group”.
[cca_convert C=n] or [cca_convert F=n] (where “n” is the number of degrees in Celsius or Fahrenheit): Displays the specified temperature in the scale used by your visitor. See live examples below.
Note: converted temperatures are rounded to the nearest degree.
Live Examples:
actual text in post | visitor from YOUR country sees: |
---|---|
15% discount for visitors from [cca_countryname] | 15% discount for visitors from United States |
[cca_countrycode] <img src=”yourImages/yourFlags/[cca_countrycode].png” /> |
US |
[cca_convert C=-2] is cold | 28°F is cold |
[cca_convert F=95.5] is hot | 95.5°F is hot |
[cca_display only=US,GB,IN]THIS PARAGRAPH IS ONLY DISPLAYED TO VISITORS FROM USA, UK, & INDIA[/cca_display] Some information for everyone… … Note: you can use OTHER SHORTCODES within the cca_display shortcode. |
THIS PARAGRAPH IS ONLY DISPLAYED TO VISITORS FROM USA, UK, & INDIA
Some information for everyone… |
United States….
[cca_display not=US]Some info for non-residents…[/cca_display]
Some information for everyone… … |
United States….
Some information for everyone… |
The Baltic States ….
[cca_display not=LV,LT]Some info for non-residents… … …[/cca_display]
Some info for everyone… |
The Baltic States ….
Some info for non-residents…
… … Some info for everyone… |
You are [cca_not_EU]NOT[/cca_not_EU] from the EU. [cca_not_EU]some text to request your email and javascript advert which sets a cookie without requesting your positive consent.[/cca_not_EU] | You are NOT from the EU. Some text to request your email and javascript advert which sets a cookie without requesting your positive consent. |
Enter your email [cca_is_EU]some EU privacy compliant text + javascript to prevent [/cca_is_EU] {display of advert without cookie consent} | Enter your email {display of advert without cookie consent} |
1. Country dependent WordPress Navigation Menu
2. Using CCA to restrict Cookie Notice to EU visitors only
3. The CCA plugin and GeoLocation systems
4. If you are using a caching plugin
Advanced:
5. Use in your own code and plugins: available CCA methods, functions, Filters & Actions
6. Configuring the CCA plugin to use another GeoIP system installed on your site: See CCA and GeoLocation
Why on earth would you include a NOT filter shortcode to hide information from selected countries but not a positive filter to only show information to certain countries? That is nonsensical and I can only assume it is deliberate for some reason?
Update: the option you wanted was already in the free add-on however I’ve now added it to the core CCA plugin.
Hi Jeremy
1. An ONLY filter (i.e display only for these countries) for the shortcode is available via a free extension (see the CCA Extensions page).
2. When I get time I will move this option to to the core plugin (along with the sidebar widget option “to not display by default, or for selected category/country option)
3. As with many plugin authors the plugin was a result of things I initially needed myself e.g. display NOT. The plugin has been designed to enable users to add there own extensions, and it was easier for me initially to quickly add the “display only” shortcode to the extension. Providing useful features via the extension also serves to highlight to users that they can use the plugins extensions capability to write their own useful add-ons to the CCA plugin.
Hope this helps