update;
Contact Form 7 country list - methods to populate all countries drop-down & respective states-cities in my contact form
I want to populate all countries drop-down & respective states-cities in my contact form, I'm using Contact Form 7.
i have done some research and found several options:
- one option is to populate all county values in shortcode.
- another option is to add country to be selected from drop-down,
only then respective states will be visible & the same logic will go for cities as depending on the states.
plugins and ideas:
- Country drop-down menu for Contact Form 7.
https://de.wordpress.org/plugins/cf7-countries/with this plugin we will get „countries drop down“ Form tag in CF7. The countries list is the same countries list used by WooCommerce.
- listo:
http://contactform7.com/listo/we used Listo (a wordpress plugin) and added the writing [select countries data:countries] list of contries.
note: I want Get Current country(Find by IP) in cf 7 dropdown.
so the steps to take:
Below I find the country by IP:
Country[select* countrylist id:Country "Please Select a Country" "United States|USA" "Afghanistan|AFG" "Albania|ALB" "Algeria|DZA" "American Samoa|ASM" ........ ]
(Note: ..... means list all countries defined)
since Contact Form 7 doesn't have a ready country list by default. we can go ahead and do the population of the values on our own:
we can populate all values by ourself: here some methods, options and dataset:
cf.
https://gist.github.com/MatthewEppelsheimer/1498955<?php
/*
UPDATED: December 31, 2011.
Modifications:
- Truncated the longest country names, including:
-- British Indian Ocean Territories (Chagos Archipelago) -> British Indian Ocean Territories
-- South Georgia and the South Sandhich Islands -> South Georgia & S. Sandwich Islands
UPDATED: December 19, 2011.
List taken from
http://en.wikipedia.org/wiki/List_of_so ... (data_file)
Modifications:
- deleted Antarctica
- removed meta data
- removed full names following commas
- sorted by alpha
- anglo- and North America-centric re-ordering
- addition of short code wrapper
*/
?>
[select country "United States" "Canada" "Mexico" "United Kingdom" "-----" "Afghanistan" "Albania"
cf.
https://gist.github.com/MatthewEppelsheimer/1498955see this is a list of countries:
[select country "United States" "Canada" "Mexico" "United Kingdom" "-----" "Afghanistan" "Albania" "Algeria" "American Samoa" "Andorra" "Angola" "Anguilla" "Antigua and Barbuda" "Argentina" "Armenia" "Armenia" "Aruba" "Australia" "Austria" "Azerbaijan" "Azerbaijan" "Bahamas" "Bahrain" "Bangladesh" "Barbados" "Belarus" "Belgium" "Belize" "Benin" "Bermuda" "Bhutan" "Bolivia" "Bonaire" "Bosnia and Herzegovina" "Botswana" "Bouvet Island (Bouvetoya)" "Brazil" "British Indian Ocean Territory (Chagos Archipelago)" "British Virgin Islands" "Brunei Darussalam" "Bulgaria" "Burkina Faso" "Burundi" "Cambodia" "Cameroon" "Cape Verde" "Cayman Islands" "Central African Republic" "Chad" "Chile" "China" "Christmas Island" "Cocos (Keeling) Islands" "Colombia" "Comoros" "Congo" "Congo" "Cook Islands" "Costa Rica" "Cote d'Ivoire" "Croatia" "Cuba" "Curaçao" "Cyprus" "Cyprus" "Czech Republic" "Denmark" "Djibouti" "Dominica" "Dominican Republic" "Ecuador" "Egypt" "El Salvador" "Equatorial Guinea" "Eritrea" "Estonia" "Ethiopia" "Falkland Islands (Malvinas)" "Faroe Islands" "Fiji" "Finland" "France" "French Guiana" "French Polynesia" "French Southern Territories" "Gabon" "Gambia" "Georgia" "Georgia" "Germany" "Ghana" "Gibraltar" "Greece" "Greenland" "Grenada" "Guadeloupe" "Guam" "Guatemala" "Guernsey" "Guinea" "Guinea-Bissau" "Guyana" "Haiti" "Heard Island and McDonald Islands" "Holy See (Vatican City State)" "Honduras" "Hong Kong" "Hungary" "Iceland" "India" "Indonesia" "Iran" "Iraq" "Ireland" "Isle of Man" "Israel" "Italy" "Jamaica" "Japan" "Jersey" "Jordan" "Kazakhstan" "Kazakhstan" "Kenya" "Kiribati" "Korea" "Korea" "Kuwait" "Kyrgyz Republic" "Lao People's Democratic Republic" "Latvia" "Lebanon" "Lesotho" "Liberia" "Libyan Arab Jamahiriya" "Liechtenstein" "Lithuania" "Luxembourg" "Macao" "Macedonia" "Madagascar" "Malawi" "Malaysia" "Maldives" "Mali" "Malta" "Marshall Islands" "Martinique" "Mauritania" "Mauritius" "Mayotte" "Micronesia" "Moldova" "Monaco" "Mongolia" "Montenegro" "Montserrat" "Morocco" "Mozambique" "Myanmar" "Namibia" "Nauru" "Nepal" "Netherlands" "Netherlands Antilles" "New Caledonia" "New Zealand" "Nicaragua" "Niger" "Nigeria" "Niue" "Norfolk Island" "Northern Mariana Islands" "Norway" "Oman" "Pakistan" "Palau" "Palestinian Territory" "Panama" "Papua New Guinea" "Paraguay" "Peru" "Philippines" "Pitcairn Islands" "Poland" "Portugal" "Puerto Rico" "Qatar" "Reunion" "Romania" "Russian Federation" "Rwanda" "Saint Barthelemy" "Saint Helena" "Saint Kitts and Nevis" "Saint Lucia" "Saint Martin" "Saint Pierre and Miquelon" "Saint Vincent and the Grenadines" "Samoa" "San Marino" "Sao Tome and Principe" "Saudi Arabia" "Senegal" "Serbia" "Seychelles" "Sierra Leone" "Singapore" "Sint Maarten (Netherlands)" "Slovakia (Slovak Republic)" "Slovenia" "Solomon Islands" "Somalia" "South Africa" "South Georgia & S. Sandwich Islands" "Spain" "Sri Lanka" "Sudan" "Suriname" "Svalbard & Jan Mayen Islands" "Swaziland" "Sweden" "Switzerland" "Syrian Arab Republic" "Taiwan" "Tajikistan" "Tanzania" "Thailand" "Timor-Leste" "Togo" "Tokelau" "Tonga" "Trinidad and Tobago" "Tunisia" "Turkey" "Turkey" "Turkmenistan" "Turks and Caicos Islands" "Tuvalu" "U.S. Virgin Islands" "U.S. Minor Outlying Islands" "Uganda" "Ukraine" "United Arab Emirates" "Uruguay" "Uzbekistan" "Vanuatu" "Venezuela" "Vietnam" "Wallis and Futuna" "Western Sahara" "Yemen" "Zambia" "Zimbabwe"]
Source:
https://gist.github.com/MatthewEppelsheimer/1498955btw: see the solution for swiss-cities: all Swiss Orts (cities/villages)
[select Ort size:15 placeholder:_Ort_eingeben "Aadorf" "Aarau" "Aarberg" "Aarburg" "Aarwangen" "Zwieselberg" "Zwingen" "Zwischbergen"]