Skip to content

Instantly share code, notes, and snippets.

@jaredatch
Created November 11, 2016 16:20
Show Gist options
  • Select an option

  • Save jaredatch/be99f7b2a2cd00d6dc3af86483110595 to your computer and use it in GitHub Desktop.

Select an option

Save jaredatch/be99f7b2a2cd00d6dc3af86483110595 to your computer and use it in GitHub Desktop.
WPForms add new address field scheme
<?php
/**
* WPForms Add new address field scheme (Canada)
*
* @param array $schemes
* @return array
*/
function wpf_new_address_scheme( $schemes ) {
$schemes['canada'] = array(
'label' => 'Canada',
'address1_label' => 'Address Line 1',
'address2_label' => 'Address Line 2',
'city_label' => 'City',
'postal_label' => 'Code Postal',
'state_label' => 'Province',
'states' => array(
'AB' => 'Alberta',
'BC' => 'British Columbia',
'MB' => 'Manitoba',
'NB' => 'New Brunswick',
'NL' => 'Newfoundland and Labrador',
'NS' => 'Nova Scotia',
'ON' => 'Ontario',
'PE' => 'Prince Edward Island',
'WQ' => 'Quebec',
'SK' => 'Saskatchewan',
),
);
return $schemes;
}
add_filter( 'wpforms_address_schemes', 'wpf_new_address_scheme' );
@paulmatthewm
Copy link

Works great - Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment