Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save matadorjobs/4e6052929df4c7e2bb6e7a41fbcd7385 to your computer and use it in GitHub Desktop.
Save matadorjobs/4e6052929df4c7e2bb6e7a41fbcd7385 to your computer and use it in GitHub Desktop.
Change the state/province application form field to a drop-down of US states and territories.
<?php // omit opening PHP tag
add_filter( 'matador_application_fields_structure', 'mdocs_change_state_field_to_US_states_dropdown', 50, 1 );
/**
* Matador Change "State" to US States Dropdown
*
* Change the state/province application form field to a drop-down (<select>) of US states and territories.
*
* @since 2021-02-22
*
* @param array $fields Array of Form Fields
*
* @return array
*/
function mdocs_change_state_field_to_US_states_dropdown( $fields ) {
$fields['state']['type'] = 'select';
$fields['state']['options'] = array(
'Alabama' => 'Alabama',
'Alaska' => 'Alaska',
'American Samoa' => 'American Samoa',
'Arizona' => 'Arizona',
'Arkansas' => 'Arkansas',
'California' => 'California',
'Colorado' => 'Colorad',
'Connecticut' => 'Connecticut',
'Deleware' => 'Deleware',
'District of Columbia' => 'District of Columbia',
'Federated States of Micronesia' => 'Federated States of Micronesia',
'Florida' => 'Florida',
'Georgia' => 'Georgia',
'Guam' => 'Guam',
'Hawaii' => 'Hawaii',
'Idaho' => 'Idaho',
'Illinois' => 'Illinois',
'Indiana' => 'Indiana',
'Iowa' => 'Iowa',
'Kansas' => 'Kansas',
'Kentucky' => 'Kentucky',
'Louisiana' => 'Louisiana',
'Maine' => 'Maine',
'Marshall Islands' => 'Marshall Islands',
'Maryland' => 'Maryland',
'Massachusetts' => 'Massachusetts',
'Michigan' => 'Michigan',
'Minnesota' => 'Minnesota',
'Mississippi' => 'Mississippi',
'Missouri' => 'Missouri',
'Montana' => 'Montana',
'Nebraska' => 'Nebraska',
'Nevada' => 'Nevada',
'New Hampshire' => 'New Hampshire',
'New Jersey' => 'New Jersey',
'New Mexico' => 'New Mexico',
'New York' => 'New York',
'North Carolina' => 'North Carolina',
'North Dakota' => 'North Dakota',
'Northern Mariana Islands' => 'Northern Mariana Islands',
'Ohio' => 'Ohio',
'Oklahoma' => 'Oklahoma',
'Oregon' => 'Oregon',
'Palau' => 'Palau',
'Pennsylvania' => 'Pennsylvania',
'Puerto Rico' => 'Puerto Rico',
'Rhode Island' => 'Rhode Island',
'South Carolina' => 'South Carolina',
'South Dakota' => 'South Dakota',
'Tennessee' => 'Tennessee',
'Texas' => 'Texas',
'Utah' => 'Utah',
'Vermont' => 'Vermont',
'Virgin Islands' => 'Virgin Islands',
'Virginia' => 'Virginia',
'Washington' => 'Washington',
'West Virginia' => 'West Virginia',
'Wisconsin' => 'Wisconsin',
'Wyoming' => 'Wyoming',
'Armed Forces Europe' => 'Armed Forces Africa \ Canada \ Europe \ Middle East',
'Armed Forces America' => 'Armed Forces America (Except Canada)',
'Armed Forces Pacific' => 'Armed Forces Pacific',
);
return $fields;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment