Imagine that you need to make a contact form that has fields for the sender’s location and you want them to choose their country from a list. There are about 200 countries in the world — you’ll soon realize that the list becomes terribly long.
Previously, the only way to generate such a long list with Contact Form 7 was to manually add all the options into a form-tag as shown below.
[select your-country “Aruba” “Afghanistan” “Angola” “Albania” “Andorra” “United Arab Emirates” “Argentina” “Armenia” “American Samoa” “Antigua and Barbuda” “Australia” “Austria” “Azerbaijan” “Burundi” “Belgium” “Benin” “Burkina Faso” “Bangladesh” “Bulgaria” “Bahrain” “Bahamas” “Bosnia and Herzegovina” “Belarus” “Belize” “Bermuda” “Bolivia, Plurinational State of” “Brazil” “Barbados” “Brunei Darussalam” “Bhutan” “Botswana” “Central African Republic” “Canada” “Switzerland” “Chile” “China” “Côte d’Ivoire” “Cameroon” “Congo, the Democratic Republic of the” “Congo” “Cook Islands” “Colombia” “Comoros” “Cape Verde” “Costa Rica” “Cuba” “Cayman Islands” “Cyprus” “Czech Republic” “Germany” “Djibouti” “Dominica” “Denmark” “Dominican Republic” “Algeria” “Ecuador” “Egypt” “Eritrea” “Spain” “Estonia” “Ethiopia” “Finland” “Fiji” “France” “Micronesia, Federated States of” “Gabon” “United Kingdom” “Georgia” “Ghana” “Guinea” “Gambia” “Guinea-Bissau” “Equatorial Guinea” “Greece” “Grenada” “Guatemala” “Guam” “Guyana” “Hong Kong” “Honduras” “Croatia” “Haiti” “Hungary” “Indonesia” “India” “Ireland” “Iran, Islamic Republic of” “Iraq” “Iceland” “Israel” “Italy” “Jamaica” “Jordan” “Japan” “Kazakhstan” “Kenya” “Kyrgyzstan” “Cambodia” “Kiribati” “Saint Kitts and Nevis” “Korea, Republic of” “Kuwait” “Lao People’s Democratic Republic” “Lebanon” “Liberia” “Libya” “Saint Lucia” “Liechtenstein” “Sri Lanka” “Lesotho” “Lithuania” “Luxembourg” “Latvia” “Morocco” “Monaco” “Moldova, Republic of” “Madagascar” “Maldives” “Mexico” “Marshall Islands” “Macedonia, the former Yugoslav Republic of” “Mali” “Malta” “Myanmar” “Montenegro” “Mongolia” “Mozambique” “Mauritania” “Mauritius” “Malawi” “Malaysia” “Namibia” “Niger” “Nigeria” “Nicaragua” “Netherlands” “Norway” “Nepal” “Nauru” “New Zealand” “Oman” “Pakistan” “Panama” “Peru” “Philippines” “Palau” “Papua New Guinea” “Poland” “Puerto Rico” “Korea, Democratic People’s Republic of” “Portugal” “Paraguay” “Palestine, State of” “Qatar” “Romania” “Russian Federation” “Rwanda” “Saudi Arabia” “Sudan” “Senegal” “Singapore” “Solomon Islands” “Sierra Leone” “El Salvador” “San Marino” “Somalia” “Serbia” “Sao Tome and Principe” “Suriname” “Slovakia” “Slovenia” “Sweden” “Swaziland” “Seychelles” “Syrian Arab Republic” “Chad” “Togo” “Thailand” “Tajikistan” “Turkmenistan” “Timor-Leste” “Tonga” “Trinidad and Tobago” “Tunisia” “Turkey” “Tuvalu” “Taiwan, Province of China” “Tanzania, United Republic of” “Uganda” “Ukraine” “Uruguay” “United States” “Uzbekistan” “Saint Vincent and the Grenadines” “Venezuela, Bolivarian Republic of” “Virgin Islands, U.S.” “Viet Nam” “Vanuatu” “Samoa” “Yemen” “South Africa” “Zambia” “Zimbabwe”]
Managing 200 or more options is almost impossible, and parsing this form-tag would consume memory and time on your server computer. The situation of a list of countries in a contact form is not that rare; it should be easier to set up. That’s why I created Listo, another WordPress plugin.
Listo is a simple plugin that provides several kinds of common lists for other plugins like Contact Form 7. Listo currently provides lists of world countries, U.S. subdivisions, and world currencies (shown at the bottom of this page), with more to come.
Contact Form 7 supports cooperation with Listo and allows drop-down menus, checkboxes, and radio buttons, with a long list of options that Listo provides. You don’t need painful manual editing anymore.
How to manage long lists in a contact form
Let’s try creating a drop-down menu for selecting a country. We get the option values from Listo, so activate Listo if it’s not active yet.
Let’s start by creating a form-tag for a typical drop-down menu. We use [select]
form-tag.
[select your-country]
This tag doesn’t have values yet, so it will be displayed as an empty menu. Next, we add the countries list as its option values. To add values provided by Listo, add a ‘data’ option to a form-tag, like this.
[select your-country data:countries]
Just adding data:countries
gives the menu about 200 country options. Simple, right?
Looking through the menu items, you may find something unexpected; for example, “Antarctica” is in the countries list. Is Antarctica a country where people live? The reason Antarctica is in the list is that the data source of the countries list is the ISO 3166 standard, which includes some non-country special areas.
Thus, the definition of a country can differ according to standards. For dealing with different definitions, Listo also provides a grouping function. For the world countries list, Listo provides two subgroups: “un” and “olympic”. The “un” subgroup only includes members of the United Nations, while the “olympic” subgroup only includes participating nations at the 2012 London Summer Olympic Games. A complete list with subgroups is shown at the bottom of this page.
To specify the data option with subgroup, append a period (.) and the name of subgroup to the option.
[select your-country data:countries.olympic]
This menu will only include participating Olympic nations in its options; you won’t see Antarctica there.
The complete lists Listo provides
Countries [countries]
A list of countries and dependent territories based on the ISO 3166 standard.
Usage example:
[select your-country data:countries.olympic]
Name | In Group | |
---|---|---|
1 | Aruba | olympic |
2 | Afghanistan | un, olympic |
3 | Angola | un, olympic |
4 | Anguilla | |
5 | Åland Islands | |
6 | Albania | un, olympic |
7 | Andorra | un, olympic |
8 | United Arab Emirates | un, olympic |
9 | Argentina | un, olympic |
10 | Armenia | un, olympic |
11 | American Samoa | olympic |
12 | Antarctica | |
13 | French Southern Territories | |
14 | Antigua and Barbuda | un, olympic |
15 | Australia | un, olympic |
16 | Austria | un, olympic |
17 | Azerbaijan | un, olympic |
18 | Burundi | un, olympic |
19 | Belgium | un, olympic |
20 | Benin | un, olympic |
21 | Bonaire, Sint Eustatius and Saba | |
22 | Burkina Faso | un, olympic |
23 | Bangladesh | un, olympic |
24 | Bulgaria | un, olympic |
25 | Bahrain | un, olympic |
26 | Bahamas | un, olympic |
27 | Bosnia and Herzegovina | un, olympic |
28 | Saint Barthélemy | |
29 | Belarus | un, olympic |
30 | Belize | un, olympic |
31 | Bermuda | olympic |
32 | Bolivia, Plurinational State of | un, olympic |
33 | Brazil | un, olympic |
34 | Barbados | un, olympic |
35 | Brunei Darussalam | un, olympic |
36 | Bhutan | un, olympic |
37 | Bouvet Island | |
38 | Botswana | un, olympic |
39 | Central African Republic | un, olympic |
40 | Canada | un, olympic |
41 | Cocos (Keeling) Islands | |
42 | Switzerland | un, olympic |
43 | Chile | un, olympic |
44 | China | un, olympic |
45 | Côte d'Ivoire | un, olympic |
46 | Cameroon | un, olympic |
47 | Congo, Democratic Republic of the | un, olympic |
48 | Congo | un, olympic |
49 | Cook Islands | olympic |
50 | Colombia | un, olympic |
51 | Comoros | un, olympic |
52 | Cabo Verde | un, olympic |
53 | Costa Rica | un, olympic |
54 | Cuba | un, olympic |
55 | Curaçao | |
56 | Christmas Island | |
57 | Cayman Islands | olympic |
58 | Cyprus | un, olympic |
59 | Czechia | un, olympic |
60 | Germany | un, olympic |
61 | Djibouti | un, olympic |
62 | Dominica | un, olympic |
63 | Denmark | un, olympic |
64 | Dominican Republic | un, olympic |
65 | Algeria | un, olympic |
66 | Ecuador | un, olympic |
67 | Egypt | un, olympic |
68 | Eritrea | un, olympic |
69 | Western Sahara | |
70 | Spain | un, olympic |
71 | Estonia | un, olympic |
72 | Ethiopia | un, olympic |
73 | Finland | un, olympic |
74 | Fiji | un, olympic |
75 | Falkland Islands (Malvinas) | |
76 | France | un, olympic |
77 | Faroe Islands | |
78 | Micronesia, Federated States of | un, olympic |
79 | Gabon | un, olympic |
80 | United Kingdom of Great Britain and Northern Ireland | un, olympic |
81 | Georgia | un, olympic |
82 | Guernsey | |
83 | Ghana | un, olympic |
84 | Gibraltar | |
85 | Guinea | un, olympic |
86 | Guadeloupe | |
87 | Gambia | un, olympic |
88 | Guinea-Bissau | un, olympic |
89 | Equatorial Guinea | un, olympic |
90 | Greece | un, olympic |
91 | Grenada | un, olympic |
92 | Greenland | |
93 | Guatemala | un, olympic |
94 | French Guiana | |
95 | Guam | olympic |
96 | Guyana | un, olympic |
97 | Hong Kong | olympic |
98 | Heard Island and McDonald Islands | |
99 | Honduras | un, olympic |
100 | Croatia | un, olympic |
101 | Haiti | un, olympic |
102 | Hungary | un, olympic |
103 | Indonesia | un, olympic |
104 | Isle of Man | |
105 | India | un, olympic |
106 | British Indian Ocean Territory | |
107 | Ireland | un, olympic |
108 | Iran, Islamic Republic of | un, olympic |
109 | Iraq | un, olympic |
110 | Iceland | un, olympic |
111 | Israel | un, olympic |
112 | Italy | un, olympic |
113 | Jamaica | un, olympic |
114 | Jersey | |
115 | Jordan | un, olympic |
116 | Japan | un, olympic |
117 | Kazakhstan | un, olympic |
118 | Kenya | un, olympic |
119 | Kyrgyzstan | un, olympic |
120 | Cambodia | un, olympic |
121 | Kiribati | un, olympic |
122 | Saint Kitts and Nevis | un, olympic |
123 | Korea, Republic of | un, olympic |
124 | Kuwait | un, olympic |
125 | Lao People's Democratic Republic | un, olympic |
126 | Lebanon | un, olympic |
127 | Liberia | un, olympic |
128 | Libya | un, olympic |
129 | Saint Lucia | un, olympic |
130 | Liechtenstein | un, olympic |
131 | Sri Lanka | un, olympic |
132 | Lesotho | un, olympic |
133 | Lithuania | un, olympic |
134 | Luxembourg | un, olympic |
135 | Latvia | un, olympic |
136 | Macao | |
137 | Saint Martin (French part) | |
138 | Morocco | un, olympic |
139 | Monaco | un, olympic |
140 | Moldova, Republic of | un, olympic |
141 | Madagascar | un, olympic |
142 | Maldives | un, olympic |
143 | Mexico | un, olympic |
144 | Marshall Islands | un, olympic |
145 | North Macedonia | un, olympic |
146 | Mali | un, olympic |
147 | Malta | un, olympic |
148 | Myanmar | un, olympic |
149 | Montenegro | un, olympic |
150 | Mongolia | un, olympic |
151 | Northern Mariana Islands | |
152 | Mozambique | un, olympic |
153 | Mauritania | un, olympic |
154 | Montserrat | |
155 | Martinique | |
156 | Mauritius | un, olympic |
157 | Malawi | un, olympic |
158 | Malaysia | un, olympic |
159 | Mayotte | |
160 | Namibia | un, olympic |
161 | New Caledonia | |
162 | Niger | un, olympic |
163 | Norfolk Island | |
164 | Nigeria | un, olympic |
165 | Nicaragua | un, olympic |
166 | Niue | |
167 | Netherlands, Kingdom of the | un, olympic |
168 | Norway | un, olympic |
169 | Nepal | un, olympic |
170 | Nauru | un, olympic |
171 | New Zealand | un, olympic |
172 | Oman | un, olympic |
173 | Pakistan | un, olympic |
174 | Panama | un, olympic |
175 | Pitcairn | |
176 | Peru | un, olympic |
177 | Philippines | un, olympic |
178 | Palau | un, olympic |
179 | Papua New Guinea | un, olympic |
180 | Poland | un, olympic |
181 | Puerto Rico | olympic |
182 | Korea, Democratic People's Republic of | un, olympic |
183 | Portugal | un, olympic |
184 | Paraguay | un, olympic |
185 | Palestine, State of | olympic |
186 | French Polynesia | |
187 | Qatar | un, olympic |
188 | Réunion | |
189 | Romania | un, olympic |
190 | Russian Federation | un, olympic |
191 | Rwanda | un, olympic |
192 | Saudi Arabia | un, olympic |
193 | Sudan | un, olympic |
194 | Senegal | un, olympic |
195 | Singapore | un, olympic |
196 | South Georgia and the South Sandwich Islands | |
197 | Saint Helena, Ascension and Tristan da Cunha | |
198 | Svalbard and Jan Mayen | |
199 | Solomon Islands | un, olympic |
200 | Sierra Leone | un, olympic |
201 | El Salvador | un, olympic |
202 | San Marino | un, olympic |
203 | Somalia | un, olympic |
204 | Saint Pierre and Miquelon | |
205 | Serbia | un, olympic |
206 | South Sudan | un, olympic |
207 | Sao Tome and Principe | un, olympic |
208 | Suriname | un, olympic |
209 | Slovakia | un, olympic |
210 | Slovenia | un, olympic |
211 | Sweden | un, olympic |
212 | Eswatini | un, olympic |
213 | Sint Maarten (Dutch part) | |
214 | Seychelles | un, olympic |
215 | Syrian Arab Republic | un, olympic |
216 | Turks and Caicos Islands | |
217 | Chad | un, olympic |
218 | Togo | un, olympic |
219 | Thailand | un, olympic |
220 | Tajikistan | un, olympic |
221 | Tokelau | |
222 | Turkmenistan | un, olympic |
223 | Timor-Leste | un, olympic |
224 | Tonga | un, olympic |
225 | Trinidad and Tobago | un, olympic |
226 | Tunisia | un, olympic |
227 | Türkiye | un, olympic |
228 | Tuvalu | un, olympic |
229 | Taiwan, Province of China | olympic |
230 | Tanzania, United Republic of | un, olympic |
231 | Uganda | un, olympic |
232 | Ukraine | un, olympic |
233 | United States Minor Outlying Islands | |
234 | Uruguay | un, olympic |
235 | United States of America | un, olympic |
236 | Uzbekistan | un, olympic |
237 | Holy See | |
238 | Saint Vincent and the Grenadines | un, olympic |
239 | Venezuela, Bolivarian Republic of | un, olympic |
240 | Virgin Islands, British | olympic |
241 | Virgin Islands, U.S. | olympic |
242 | Viet Nam | un, olympic |
243 | Vanuatu | un, olympic |
244 | Wallis and Futuna | |
245 | Samoa | un, olympic |
246 | Yemen | un, olympic |
247 | South Africa | un, olympic |
248 | Zambia | un, olympic |
249 | Zimbabwe | un, olympic |
U.S. subdivisions [us_subdivisions]
The list of subdivisions of the United States based on the ISO 3166-2:US standard.
Usage example:
[select your-state data:us_subdivisions.states data:us_subdivisions.districts]
Name | In Group | |
---|---|---|
1 | Alaska | states |
2 | Alabama | states |
3 | Arkansas | states |
4 | American Samoa | outlying_areas |
5 | Arizona | states |
6 | California | states |
7 | Colorado | states |
8 | Connecticut | states |
9 | District of Columbia | districts |
10 | Delaware | states |
11 | Florida | states |
12 | Georgia | states |
13 | Guam | outlying_areas |
14 | Hawaii | states |
15 | Iowa | states |
16 | Idaho | states |
17 | Illinois | states |
18 | Indiana | states |
19 | Kansas | states |
20 | Kentucky | states |
21 | Louisiana | states |
22 | Massachusetts | states |
23 | Maryland | states |
24 | Maine | states |
25 | Michigan | states |
26 | Minnesota | states |
27 | Missouri | states |
28 | Northern Mariana Islands | outlying_areas |
29 | Mississippi | states |
30 | Montana | states |
31 | North Carolina | states |
32 | North Dakota | states |
33 | Nebraska | states |
34 | New Hampshire | states |
35 | New Jersey | states |
36 | New Mexico | states |
37 | Nevada | states |
38 | New York | states |
39 | Ohio | states |
40 | Oklahoma | states |
41 | Oregon | states |
42 | Pennsylvania | states |
43 | Puerto Rico | outlying_areas |
44 | Rhode Island | states |
45 | South Carolina | states |
46 | South Dakota | states |
47 | Tennessee | states |
48 | Texas | states |
49 | United States Minor Outlying Islands | outlying_areas |
50 | Utah | states |
51 | Virginia | states |
52 | Virgin Islands, U.S. | outlying_areas |
53 | Vermont | states |
54 | Washington | states |
55 | Wisconsin | states |
56 | West Virginia | states |
57 | Wyoming | states |
Currencies [currencies]
A list of currencies based on the ISO 4217 standard.
Usage example:
[select your-currency data:currencies]
Name | In Group | |
---|---|---|
1 | United Arab Emirates dirham | |
2 | Afghan afghani | |
3 | Albanian lek | |
4 | Armenian dram | |
5 | Netherlands Antillean guilder | |
6 | Angolan kwanza | |
7 | Argentine peso | |
8 | Australian dollar | |
9 | Aruban florin | |
10 | Azerbaijani manat | |
11 | Bosnia and Herzegovina convertible mark | |
12 | Barbados dollar | |
13 | Bangladeshi taka | |
14 | Bulgarian lev | |
15 | Bahraini dinar | |
16 | Burundian franc | |
17 | Bermudian dollar | |
18 | Brunei dollar | |
19 | Boliviano | |
20 | Brazilian real | |
21 | Bahamian dollar | |
22 | Bhutanese ngultrum | |
23 | Botswana pula | |
24 | Belarusian ruble | |
25 | Belize dollar | |
26 | Canadian dollar | |
27 | Congolese franc | |
28 | Swiss franc | |
29 | Chilean peso | |
30 | Chinese yuan | |
31 | Colombian peso | |
32 | Costa Rican colon | |
33 | Cuban peso | |
34 | Cape Verde escudo | |
35 | Czech koruna | |
36 | Djiboutian franc | |
37 | Danish krone | |
38 | Dominican peso | |
39 | Algerian dinar | |
40 | Egyptian pound | |
41 | Eritrean nakfa | |
42 | Ethiopian birr | |
43 | Euro | |
44 | Fiji dollar | |
45 | Falkland Islands pound | |
46 | Pound sterling | |
47 | Georgian lari | |
48 | Ghanaian cedi | |
49 | Gibraltar pound | |
50 | Gambian dalasi | |
51 | Guinean franc | |
52 | Guatemalan quetzal | |
53 | Guyanese dollar | |
54 | Hong Kong dollar | |
55 | Honduran lempira | |
56 | Croatian kuna | |
57 | Haitian gourde | |
58 | Hungarian forint | |
59 | Indonesian rupiah | |
60 | Israeli new shekel | |
61 | Indian rupee | |
62 | Iraqi dinar | |
63 | Iranian rial | |
64 | Icelandic króna | |
65 | Jamaican dollar | |
66 | Jordanian dinar | |
67 | Japanese yen | |
68 | Kenyan shilling | |
69 | Kyrgyzstani som | |
70 | Cambodian riel | |
71 | Comoro franc | |
72 | North Korean won | |
73 | South Korean won | |
74 | Kuwaiti dinar | |
75 | Cayman Islands dollar | |
76 | Kazakhstani tenge | |
77 | Lao kip | |
78 | Lebanese pound | |
79 | Sri Lankan rupee | |
80 | Liberian dollar | |
81 | Lesotho loti | |
82 | Lithuanian litas | |
83 | Libyan dinar | |
84 | Moroccan dirham | |
85 | Moldovan leu | |
86 | Malagasy ariary | |
87 | Macedonian denar | |
88 | Myanma kyat | |
89 | Mongolian tugrik | |
90 | Macanese pataca | |
91 | Mauritanian ouguiya | |
92 | Mauritian rupee | |
93 | Maldivian rufiyaa | |
94 | Malawian kwacha | |
95 | Mexican peso | |
96 | Malaysian ringgit | |
97 | Mozambican metical | |
98 | Namibian dollar | |
99 | Nigerian naira | |
100 | Nicaraguan córdoba | |
101 | Norwegian krone | |
102 | Nepalese rupee | |
103 | New Zealand dollar | |
104 | Omani rial | |
105 | Panamanian balboa | |
106 | Peruvian nuevo sol | |
107 | Papua New Guinean kina | |
108 | Philippine peso | |
109 | Pakistani rupee | |
110 | Polish złoty | |
111 | Paraguayan guaraní | |
112 | Qatari riyal | |
113 | Romanian new leu | |
114 | Serbian dinar | |
115 | Russian ruble | |
116 | Rwandan franc | |
117 | Saudi riyal | |
118 | Solomon Islands dollar | |
119 | Seychelles rupee | |
120 | Sudanese pound | |
121 | Swedish krona/kronor | |
122 | Singapore dollar | |
123 | Saint Helena pound | |
124 | Sierra Leonean leone | |
125 | Somali shilling | |
126 | Surinamese dollar | |
127 | South Sudanese pound | |
128 | São Tomé and Príncipe dobra | |
129 | Syrian pound | |
130 | Swazi lilangeni | |
131 | Thai baht | |
132 | Tajikistani somoni | |
133 | Turkmenistani manat | |
134 | Tunisian dinar | |
135 | Tongan paʻanga | |
136 | Turkish lira | |
137 | Trinidad and Tobago dollar | |
138 | New Taiwan dollar | |
139 | Tanzanian shilling | |
140 | Ukrainian hryvnia | |
141 | Ugandan shilling | |
142 | United States dollar | |
143 | Uruguayan peso | |
144 | Uzbekistan som | |
145 | Venezuelan bolívar | |
146 | Vietnamese dong | |
147 | Vanuatu vatu | |
148 | Samoan tala | |
149 | CFA franc BEAC | |
150 | East Caribbean dollar | |
151 | CFA franc BCEAO | |
152 | CFP franc (franc Pacifique) | |
153 | Yemeni rial | |
154 | South African rand | |
155 | Zambian kwacha | |
156 | Zimbabwe dollar |