Add country flags anywhere in your WordPress blog using simple shortcodes and/or widgets, or show visitor country flag and info based on their IP address.
This is the first version of World Flags. This version uses the software77.net ip2country database and only wraps the IPV4 version. The plugin imports the csv file into a mysql table for fast queries. Fetching of the csv IP database can be scheduled weekly using the WP cron jobs, or manually via the plugin options page.
Features
- Supports shortcodes anywhere and widgets
- Template functions and comments author flags (NEW!)
- Uses software77 IP database with more than 3 billion addresses included
- Multilingual interface
- Scheduled downloads of the IP database file
- MD5 checks to validate database before populating tables
- Uses MySQL for super fast queries
- 4 image sizes for country flags – 16, 24, 32 and 48
- Different ways to insert HTML – simple, JavaScript and jQuery
- Plugin uninstall support
Installation
Installation is the same routine as most WP plugins:
- Upload ‘word-flags’ folder to the
/wp-content/plugins/directory - Activate the plugin through the
Pluginsmenu in WordPress - Find the World Flags submenu under
Optionsmenu in your WordPress to change some settings or manually update the IP database.
Notice: You need to manually fetch the IP database the first time as the plugin does not include the files.
Using World Flags
- Place
[flag code="your-country-code/auto" size="16/24/32/48" text="yes/no"]in your posts. Example:[flag code="auto" size="48" text="yes"] - Drag the plugin widget in your Widgets menu and customize its options to show what you want.
- If you want to show the country flag for your visitor comments, you can add the flag before or after the comment text along with your custom text or use
<?php if (function_exists('world_flags_comment_flag')) world_flags_comment_flag($comment); ?>inside your comments loop in your template.
$commentis the variable that holds the comment inside your loop. - You can add
<?php if (function_exists('world_flags_insert_flag')) world_flags_insert_flag(); ?>inside your template to add flags anywhere. Optional argument
$codecan be provided to overrideautomode. Example:world_flags_insert_flag( 'US' );
You can see a working version of the plugin on this website, check the end of the sidebar and your location flag. Anyway, it’s cool to have visitors from
Warning: Please visit software77.net for their license, privacy policy and specially the periodic download limit for the database file.
World Flags Plugin @ WordPress Repository | Download (v1.1)
Come back here soon for updates, feature requests and information on future releases.

Aminus3 Photoblog Community

i used it in my site .. it`s amazing but when i trying to insert it inside the posts it does`t work
Comment by osama — August 20, 2010 @ 11:16 am
could you explain how to put it in the header on blog
thanks
Comment by osama — August 20, 2010 @ 12:17 pm
@osama: 1. what do you insert as the shortcode?
2. the php function to insert the flag inside your template will be available in the next release.
Comment by Behrooz — August 21, 2010 @ 1:47 am
Uhhhh…. I’m not in Sweden. You plugin thinks I am.
Comment by Kerry Webster — August 21, 2010 @ 7:17 am
After submitting my comment. The flag refreshed to United States. Maybe some caching going on?
Comment by Kerry Webster — August 21, 2010 @ 7:18 am
@Kerry: Thanks for the issue report. I’m still tweaking the getting around cache ways. I hope I’ll fix this in the next release pretty soon.
Comment by Behrooz — August 21, 2010 @ 9:31 am
[...] World Flags allows you to add country flags anywhere in your WordPress blog using simple shortcodes and/or widgets, or show visitor country flag and info based on their IP address. [...]
Pingback by WordPress Plugin Releases for 08/20/2010 | Cambodia IT Solution — August 21, 2010 @ 12:59 pm
When i want to update the database i get this error…
Fatal error: Out of memory (allocated 45350912) (tried to allocate 524288 bytes) in /mnt/weba/31/07/52273907/htdocs/hansweb/wp-content/plugins/world-flags/includes/functions.php on line 148
Help me please…
Comment by Hans Web — August 23, 2010 @ 8:18 pm
Seems like you have the memory limit problem. Hosting sometimes lower the memory_limit pretty much. add this line:
ini_set('memory_limit', '128M');somewhere at the top of the
world-flags.phpHope this would solve the problem.
Comment by Behrooz — August 23, 2010 @ 8:52 pm
Sorry, doesn’t work. Thanks anyway
Comment by Hans Web — August 24, 2010 @ 11:28 am
[...] World Flags – allows you to add country flags anywhere in your WordPress blog using simple shortcodes and/or widgets, or show visitor country flag and info based on their IP address. [...]
Pingback by Overview of New WordPress Plugins in August 2010 — tripwire magazine — August 26, 2010 @ 9:14 am
Behrooz, my friend
.. glad to see you’re still blogging!! Yay!!
I do have a question about WordPress; I’m supposed to revamp/redesign our websites at work(2 of which are e-commerce). I’ve used Frontpage and Dreamweaver neither of which I’m well versed with… but muddle through. Would WordPress be a good program for someone like me? I’m not great with code but have learned a bit.. I would prefer something very simple that my boss could use if I”m not there and something needs to be done immediately. What are your thoughts?
Comment by amy — September 1, 2010 @ 7:18 am
Hey, Amy. Thanks for passing by.
WP is a great tool if you want a website up and running even in a matter of hours. It may seem a little bit complex at first, but once you get to know it, you’ll see that it is capable of doing almost anything with a few clicks, no coding experience required. But having a really pro website and template that would look different than a blog still may need some dirty work too.
Comment by Behrooz — September 1, 2010 @ 9:58 am
let me try your plugin
i was searching for these plugin.
Comment by tommy — September 1, 2010 @ 11:58 am
Hi there!
Is there a way to use or modify this to display the country and flag on the posts of each author based on their IP address?
Thanks and best wishes,
Kristen
Comment by Kristen — September 7, 2010 @ 5:09 am
Hi
Unfortunately, I think WP doesn’t collects any IP information about users, but it can be done with some coding. You can add an action hook on publishing posts and store the author IP address and then use it in your function to get the country.
Comment by Behrooz — September 7, 2010 @ 7:53 am
thanks admin for updating these plugin, i can now easily put short code any where in the blog
nice work and keep going
Comment by osama — September 19, 2010 @ 9:32 am
Hey there, I like the plugin, but is there anyway you can add a link to the flag? On the site I’m building, I have two countries on the top, I want them to be able to select their country so I can redirect the site. I can use the auto function, but even then, they might want to change the country. Is it possible?
Comment by Travis =] — September 23, 2010 @ 2:16 am
It’s nice idea to think about. I’ll think about how to do it in the next release.
Comment by Behrooz — September 23, 2010 @ 9:39 am
Thank you! It’s always good to see an author who cares.
Just to make it more elaborate, this is my idea,
click on lets say the Canadian flag, then you can link them to yourwebsite/canada
so it’s targeted more to the user instead of a general public.
Also, is it possible as of right now to do that using a php if? I’m not very php savvy, but I know the basics of programming. Pseudo coded it would be something like this
//your code for auto flag insert into a template based on location
php if (auto flag == ca) //ca for canada
{
redirect to /canada
}
else if (auto flag == us) //us for United States
{
redirect to home
}
end php if
Just trying to think of a work around.
Thank you,
- Travis =]
Comment by Travis =] — September 23, 2010 @ 11:10 am