Skip to content

Instantly share code, notes, and snippets.

@eighty20results
Created December 12, 2015 23:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eighty20results/c1f0c33fa837a0a47ee0 to your computer and use it in GitHub Desktop.
Save eighty20results/c1f0c33fa837a0a47ee0 to your computer and use it in GitHub Desktop.
<?php
function my_add_pmpro_state_abbrev( $states )
{
// Canadian province abbreviations
$provinces = array(
"AB",
"BC",
"MB",
"NB",
"NL",
"NS",
"NT",
"NU",
"ON",
"PE",
"QC",
"SK",
"YT"
);
// Merge with received US state abbreviations (append to end)
return array_merge( $states, $provinces);
}
add_filter('pmpro_states_abbreviations', 'my_add_pmpro_state_abbrev');
function my_add_pmpro_states( $states )
{
// Canadian province abbreviations
$provinces = array(
"AB" => "Alberta",
"BC" => "British Columbia",
"MB" => "Manitoba",
"NB" => "New Brunswick",
"NL" => "Newfoundland and Labrador",
"NS" => "Nova Scotia",
"NT" => "Northwest Territories",
"NU" => "Nunavut",
"ON" => "Ontario",
"PE" => "Prince Edward Island",
"QC" => "Quebec",
"SK" => "Saskatchewan",
"YT" => "Yukon"
);
// Merge with received US state abbreviations (append to end)
return array_merge( $states, $provinces);
}
add_filter('pmpro_states', 'my_add_pmpro_states');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment