Category Country Aware WordPress

Description

Category Country Aware (CCA) plugin: GeoIP AND the most flexible Text (and RSS) Widget available. Makes your post and sidebar content much more relevant, based on post category and visitor’s locale (country).

 

Display category/visitor country relevant Adverts/content WITHIN posts.

Auto customize post content to suit the visitor’s location (country).

Make adverts responsive (i.e. sidebar or in post display), even on fixed width themes.

Make sidebar widgets (text/scripts/RSS etc) relevant to the post’s category and/or visitor’s location.

 

Features ( more info in the CCA Plugin Guide):

  • location aware Shortcodes for use in posts and pages (see CCA documentation). You can even auto convert and display temperatures in your text in the scale used by your visitor.

  • YOU control widget content based on category(s) and/or visitor’s locale(s)

  • add multiple widgets to the sidebar, each with Category/Country aware content

  • select categories by name (not by unfreindly numeric id)

  • YOU choose the number of characters to display for RSS News Item excerpts (unlike WP RSS widget)

  • option to nofollow (good for SEO) news feed links and open RSS links in new tab (unlike WP RSS widget)

  • fine tune widget look and make ads/images fit using simple check-box options to override Theme’s widget style (code free styling)

  • saves valuable sidebar space by enabling same widget to display either RSS or Text/HTML/Script content

  • uses Cloudflare country info, or Maxmind’s GeoLite Country data (with auto update option)

  • can be used with Cookie Notice plugin to limit display of notice to EU visitors only

  • extensions (developers see below) providing additional functionality (see plugin documentation)

 

Travel Blog EXAMPLE:

In one CCA sidebar widget (you can use more):

  • display a hotel booking advert/form by default

  • for posts in category “Equipment” display an Amazon.COM Travel Gadget advert;

    but if the visitor is located in the UK or Ireland display an Amazon.CO.UK equivalent;

  • category “Transport”: display a flight search advertisement

  • category “Information”: display UK Gov Travel Warnings News Feed (RSS) by default;

    but if the visitor is from US or NZ show their Government’s equivalent Feed instead

Use “Ads within posts widget” to display a gadget advert within posts in category “equipment”.

  • set widget to only display on small devices i.e. when your sidebar is not visible.

Use shortcodes to customize your posts for visitors from different countries e.g.

  • [display only=”US,GB”]some content[cca_display] will only display the enclosed content, advert etc to visitors from US and UK.

  • [cca_display not=”GB,AU”]some content[cca_display] will NOT display the enclosed content to visitors from the specified countries.

 

CCA Goodies Extension
Currently free for a tweet see this post for more info. More flexibility for sidebar widgets . More “Ads in Posts” widgets. Enable PHP.
Preview mode + view CCA content as if you are a visitor from specified country. More Geolocation shortcodes. Give pages “categories” etc etc.

 

GeoIP Country Data (both IPv4 & IPv6):

This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com .

If you use Cloudflare and have “switched on” their GeoLocation option ( see Cloudflare’s instructions )
then it will be used to identify visitor country. If not, then the Maxmind GeoLite Legacy Country Database, installed by this plugin, will be used.

Note: not tested on IPv6 (my servers are IPv4), but feedback on Stackoverflow indicates the code should work fine for IPv6. See CCA documentation for more info on GeoIP accuracy, whether you need to update the Maxmind DB, and setting up automatic update.

Experts: a hook is provided to allow you to use other GeoIP systems with this plugin.

 

For developers and coders: extensions and adding functionality via actions, filters and shortcodes

A later release of this plugin will enable you to add functionality through your own filters, actions and shortcodes. See “CCA Goodies Extension” to give you an idea of the type of functionality you can add (see CCA website for details).

This version has hooks, and RSS functionality is an extension BUT I’ve yet to tidy up & document the hooks/actions/filters. There is a chance of removal/addition and renaming.
If you want to add your own extensions or short codes then contact me.

License

This program is free software licensed under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.

In particular please note the following:

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Screenshots

  • Same 3 sidebar widgets i. on "Crime Fiction" category post (US visitor); and ii. on "Travel Guides post" (British visitor)

  • Ad in Post for category Junior fiction (smart responsive option set so ad only displays on small devices)

  • Override theme's widget styles (border, padding etc) without writing any HTML or CSS

  • Adding default content for widget:

  • Same widget, show RSS news feed for category "Travel" when visitor is from USA

  • Set up of "Ads in Posts" for category Junior Fiction:

Installation

Requirements: WordPress 3.3 and up, and PHP 5.3 or greater (tested up to PHP 7.1).

The easiest way is direct from your WP Dashboard like any other widget:

1.Plugins -> Add New -> do a search for “Category Country Aware” to find it -> click “install now”

2.Activate the plugin.

3.Use the Dashboard->’Settings’->’CCA Goodies’ and the Dashboard->’Appearance’->’Widgets’ menus to configure.

FAQ

Installation Instructions

Requirements: WordPress 3.3 and up, and PHP 5.3 or greater (tested up to PHP 7.1).

The easiest way is direct from your WP Dashboard like any other widget:

1.Plugins -> Add New -> do a search for “Category Country Aware” to find it -> click “install now”

2.Activate the plugin.

3.Use the Dashboard->’Settings’->’CCA Goodies’ and the Dashboard->’Appearance’->’Widgets’ menus to configure.

Where can I find support/additional documentation

Support questions should be posted on WordPress.Org
Additional documentation is provided at http://wptest.means.us.com/category-country-aware-wordpress/

How does the widget decide which of my category/country entries to use?

The most specific entry found is used. For less specific entries, categories have higher priority than visitor location.
So for a Fench visitor viewing a Books post: content defined for “visitor anywhere”|Category “Books” would win over content defined for “France”|Category “Any”.

Can the widget be made to execute PHP code?

Short answer:yes [via the CCA goodies extension] (http://wptest.means.us.com/cca-goodies-extension/ ) where you positively opt to allow PHP.

Long answer: any plugin enabling input of arbitrary PHP has increased security risks, however I am aware there is high demand for this feature.
To protect normal non-PHP users, you will have to positively opt to enable PHP. For security opt-in is set by a separate plugin to the widget that executes it.

Caching plugins/services have problems with dynamic content such as GeoIP. Will the country location part of the CCA plugin work with these?

Short answer:

  Yes for Cloudflare with their standard caching option

  “Perfectly” for Comet Cache and WP Supercache when using the country caching plugin extension [for WPSC] (https://wordpress.org/plugins/country-caching-extension-for-wp-super-cache/ ), or
for Comet/ZC/QC. See CCA documentation.

  W3 Total Cache: DIY solutions (less than perfect).

  Other caching plugins may or may not provide suitable settings.

If not then you can still use the CCA widget to display relevant content by category (ignoring visitor country).

full answer: see CCA documentation

Reviews

Read all 1 review

Contributors & Developers

“Category Country Aware WordPress” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

1.1.0

  • Increased the number of server variables checked to identify visitor location
  • Additional diagnostics added to CCA Settings Testing tab

1.0.1

  • 2 new boolean functions “cca_visitor_from()” and “cca_visitor_NOT_from()” e.g. “cca_visitor_from(‘CA,US’)” will return TRUE if visitor from US or Canada otherwise FALSE.
  • can be used in you own custom code or non-coders with some other plugins e.g. The Menu Items Visibility Control plugin adds a “Visibility” field to Dashboard’s Menu Settings.
  • If say, you only want a Nav Menu link to display for visitors from France or USA simply insert “cca_visitor_from(‘US,FR)” in the visibilty field and save.

0.9.2

  • Added option to set the Cookie Notice plugin to only display its cookie bar to European Union visitors ONLY.
  • Dashboard->Settings->Category Country Goodies->Countries and check the “set Cookie Notice to only display its cookie bar for these countries” box

0.9.1

  • Added filter for use by EU Cookie Law plugins to enable them to only display cookie confirmation banner to visitors from EU.
  • e.g. apply_filters( ‘cca_is_EU’,$override_list) ) or apply_filters( ‘cca_is_EU’,$override_list,”AB,CD,EF”) ). If $override_list is set to TRUE the plugin can specify its own list of countries otherwise the followinfg country codes are assumed to be the EU:
  • “BE,BG,CZ,DK,DE,EE,IE,GR,ES,FR,HR,IT,CY,LV,LT,LU,HU,MT,NL,AT,PL,PT,RO,SI,SK,FI,SE,GB”
  • modified CCA widget to use a modern constructor