• Stars
    star
    113
  • Rank 309,121 (Top 7 %)
  • Language
    PHP
  • Created almost 11 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

ACF Country field - Display a select field of all countries, in any language.

ACF Country field

Latest Version Packagist Beerpay Donate

Adds a 'Country' field type for the Advanced Custom Fields WordPress plugin.

⚠️ WARNING ⚠️

From version 2.0.0, ACF Country introduced some important breaking changes:

  • Dropped support for older PHP & ACF versions, new requirements are:
    • ACF 5.7+
    • PHP 5.4+
  • Return format has changed. To better stick to ACF and make use of ACF functions, ACF Country will now return values the same way select field do. ['FR' => 'France'] will now look like ['label' => 'France', 'value' => 'FR']

Looking for a ACF pre 5.7 support? Check the 1.0 branch.

Overview

Display a select list of all countries in your language.

Country names are available in every language (see available list). By default, country names are localized in your current WordPress language.

Select a single value:

ACF Country field

Or multiple ones:

ACF Country field

Compatibility

  • ACF 5.7+
  • PHP 5.4+

Field options

Option Default Description
Default value emtpy Set a default value for the country field (as country code)
Allow null false Enable/disable null value
Allow multiple false Enable/disable multiple countries selection
Stylised UI true Enable/disable enhanced select field thanks to Select2
Return format value  See ACF Select field

Filters

You can remove (or add) some countries with the acf/country/countries filter, example:

add_filter( 'acf/country/countries', function( $countries ) {
	return array_filter( $countries, function( $code ) {
		return !in_array( $code, ['IC', 'EA'], true );
	}, ARRAY_FILTER_USE_KEY);
} );

Note: PHP5.6+ example

Installation

Zip

Download the plugin and extract the archive to your plugins folder.

Composer

composer require hellonico/acf-country

Contributing

See CONTRIBUTING.

Support

This ACF field was originally developed for a personal project I don't use anymore. I still decided to maintain it anyway. If you use it in a commercial project, please consider buying me a beer.

More Repositories

1

wp-cli-fixtures

Easily generate custom fake data for WordPress
PHP
100
star
2

wp-better-emails

Adds a customizable good looking HTML template to all WP default plain/text emails and lets you set a custom sender name and email address.
PHP
42
star
3

timber-dump-extension

Timber dump extension
PHP
27
star
4

transmit-2-ssh-config

Sync your Transmit SFTP favorites with your ssh config file
JavaScript
6
star
5

timber-weblink-extension

Timber WebLink Extension
PHP
4
star
6

page-for-custom-post-type

Set a page for your custom post type archive, just like you would for your posts.
PHP
4
star
7

transmit-favorites-to-ssh-config

Simple python script that converts all your Transmit SFTP favorites into a ssh config file
Python
4
star
8

wp-acast-oembed

PHP
3
star
9

wordpress-french-custom-post-type-custom-taxonomy-labels-generator

WordPress french custom post type & custom taxonomy labels generator
JavaScript
3
star
10

twig-dump-extension

Standalone Symfony VarDumper Twig extension - Adds a dump function in your templates
PHP
3
star
11

nav-menu-item-hash

Adds a hash field to WordPress nav menu item.
PHP
2
star
12

wp-cli-commands

PHP
2
star
13

monolog-ray-handler

Monolog handler for Ray (from @spatie)
PHP
1
star
14

bolt-extension-minify-html

Minify HTML extension for bolt.cm
PHP
1
star
15

acf-color-palette

ACF color palette
PHP
1
star
16

var-dumper-configurator

Configure Symfony var-dumper when using outside Symfony
PHP
1
star
17

php-brotli-compress

PHP
1
star
18

acf-spreadsheet

PHP
1
star
19

block-editor-config

JavaScript
1
star
20

image-factory

PHP
1
star
21

wp-better-minify-html

Minify HTML
PHP
1
star
22

timber-run

Quickly setup a Timber environment to test or demonstrate a bug
PHP
1
star
23

wp-symfony-local-server

A set a hooks to fix running WordPress on Symfony Local Server with local domain names
PHP
1
star