WordPress.org

Ready to get started?Download WordPress

Plugin Directory

Quick Flag

Resolves IP address to ISO 3166-1 alpha-2 two-letter country code and name and displays country flag image if required.

How do I test is Quick Flag installed properly?

You can place [quick-flag] shortcode to add current IP address country name and flag image to your page or post. To display country name and flag image of IP address other than current you can use this shortcode like [quick-flag ip="some_ip_address"].

Can you provide example for fetching country info and flag for imaginary `123.123.123.123` IP address from country Croatia?

You can use something like this:

// Query database with following IP address
$ip_address = '123.123.123.123';

global $quick_flag;
if(isset($quick_flag) && is_object($quick_flag)){
    if(($info = $quick_flag->get_info($ip_address)) != false){
        $version = $info->version;      // Quick Flag version (float): 2.00
        $ip = $info->ip;                // IP address (string): 123.123.123.123
        $code = $info->code;            // Country code (string): HR
        $name = $info->name;            // Country name (string): Croatia
        $latitude = $info->latitude;    // Country latitude (float): 45.1667
        $longitude = $info->longitude;  // Country longitude (float): 15.5
        $flag = $quick_flag->get_flag($info, 'my-own-css-class'); // CSS class is optional, 'quick-flag' by default
    }
}

$flag variable will contain following string:

<img
    class="my-own-css-class"
    title="Croatia"
    src="http://www.yoursite.com/wp-content/plugins/quick-flag/img/flags/HR.gif"
/>

How do I translate country names to my own language?

Like most WordPress plugins Quick Flag can be translated using gettext. You can use Poedit application to open translation template from 'languages' directory or you can use Quick Flag online translation interface. Please keep in mind that after you change your blog language or update language files you must trigger database update to update country names inside database. Currently the easiest way to do this is to delete ip2country.db and ip2country.version files from 'database' directory and click 'Update' button in Quick Flag settings.

Requires: 3.0 or higher
Compatible up to: 3.4.2
Last Updated: 2012-11-25
Downloads: 9,598

Ratings

5 stars
5 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1
100,1,1 100,1,1
100,1,1 100,1,1
100,1,1 100,1,1 100,1,1 100,1,1
100,1,1 100,1,1
100,1,1
100,1,1 100,1,1 100,1,1 100,1,1 100,2,2
100,1,1 67,3,2
100,2,2
100,1,1
100,1,1