Directory Country Filter – a free WordPress plugin
July 1, 2016
WordPress is the most popular content management system in the world, for very good reason. It’s easy to use and has a vast developer base creating hundreds of thousands of themes and plugins – many of them free – to add almost any kind of feature you can think of.
The downside of WP’s “there’s a plugin for that” culture is that site owners often end up compromising their vision to fit into the framework of a plugin that is “close enough” to what they originally wanted.
At Venture Stream, that simply won’t do for our clients.
Our latest big project involves a WordPress blog as part of the overall site, and we discovered a missing feature in the theme/plugin combo in use. So we fixed it, and we’re releasing it publicly for others to use too.
Directory Country Filter plugin for WordPress
Please note: This is a niche plugin and does nothing on its own. Directory Country Filter was created specifically to work alongside the Directory theme and Directory ListFilter plugin, both by Templatic.
The Directory theme is a popular choice for adding directory listings and events to your site, and supports adding a location and Google map to each post. The ListFilter plugin adds a widget to let users filter those listings and events on a number of criteria. Sadly it doesn’t include filtering by country, and due to the way the Directory theme works this wasn’t a trivial feature to add. Now with our new plugin, it is.
With our Directory Country Filter plugin, you can now easily add a dropdown of available countries to your filter widget for users to choose from. See it in action below.
The plugin will be available through the WP plugin directory soon, and in the meantime you can download version 1.0.0 from by clicking this link.
Extract the directory-country-filter folder to wp-content/plugins. Alternatively upload the zip file directly to your WP admin panel through Plugins > Add New.
Visit the Plugins page in your admin panel and activate the plugin.
You’ll need a (free*) OpenCage Geocoder API key to work with locations. Get that here https://geocoder.opencagedata.com/.
Add your API key to the plugin settings under Settings > Directory Country Filter.
Add the Directory ListFilter widget to your site as usual. You’ll now see an extra checkbox available for “country”. You can drag and drop to rearrange fields in the widget as usual, and no other settings are required.
When a new event or listing is published, its country will be added to the options list if necessary and shown in the ListFilter plugin.
Here at Venture Stream we love to create the best possible solution for our clients. If you’re looking for help bringing your vision to life, get in touch today.
*As the API is only queried on post save, the free plan should be sufficient for 99.9999% of sites.