WP Country

Provides the WP_Country PHP class to get countries list as an array and dropdown countries html list in other plugins and themes.

To use the WP Country plugin in your theme or plugin add global $wp_country; into your function code, then:

  • $wp_country->all_counties is an array of country names.
  • $wp_country->dropdown() prints or returns countries as dropdown HTML SELECT tag.
  • $wp_country->name($alpha2) returns  name of a country by it’s 2-character code.


1. Upload the wp-country folder to the /wp-content/plugins/ directory.

2. Activate the plugin.

Frequently Asked Questions

Parameters Description

Advanced usage: dropdown($blank, $echo, $args); where:

  • blank: if not empty then will be added into dropdown list. Default: '' (empty string).
  • echo: prints the list if true else returns. Default: true.
  • args: an array of extra parameters. Default: array('include' => array(), 'exclude' => array(), 'name' => 'country', 'id' => '', 'selected' => array(), 'multiple' => false).

Description of args components:

  • include, exclude: an array of country codes (alpha2) should be included into dropdown list or excluded from it.
  • name: name attribute of the SELECT tag.
  • id: id attribute of the SELECT tag (not displayed by default).
  • multiple: enables multiple select.
  • selected: adds the `selected` attribute.


1.0 First release.



Now I have Russian translation. If you translate it to any other language — please let me know to add it into the package.

Добавить комментарий

Ваш email не публикуется. *
Можно использовать эти HTMLтэги и атрибуты: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>