-
-
Save webaware/f445808d0475ea0e02f2 to your computer and use it in GitHub Desktop.
Australian address fields in Gravity Forms
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Gravity Forms Aussie Addresses | |
Plugin URI: https://gist.github.com/webaware/f445808d0475ea0e02f2 | |
Description: Australian address fields in Gravity Forms | |
Author: thewebprincess | |
Author URI: https://thewebprincess.com/ | |
Version: 0.0.1 | |
@link https://gist.github.com/thewebprincess/7855509 | |
*/ | |
if (!defined('ABSPATH')) { | |
exit; | |
} | |
/** | |
* add Australia as an address type to Address fields | |
* @param array $address_types | |
* @param int $form_id | |
* @return array | |
*/ | |
add_filter('gform_address_types', function($address_types, $form_id) { | |
$address_types['australia'] = array( | |
'label' => 'Australia', | |
'country' => 'Australia', | |
'zip_label' => 'Post Code', | |
'state_label' => 'State', | |
'states' => array ( | |
'', | |
'Australian Capital Territory', | |
'New South Wales', | |
'Northern Territory', | |
'Queensland', | |
'South Australia', | |
'Tasmania', 'Victoria', | |
'Western Australia' | |
), | |
); | |
return $address_types; | |
}, 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment