-
-
Save thewebprincess/8250139 to your computer and use it in GitHub Desktop.
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 | |
add_filter( 'gform_address_types', 'your_plugin_slug_australian_address' ); | |
/** | |
* Set Gravity Forms custom addresses for Australia. | |
* | |
* @since 1.0.0 | |
* | |
* @param array $address_types Existing address formats. | |
* @param int $form_id Form ID. | |
* | |
* @return array Amended address formats. | |
*/ | |
function your_plugin_slug_australian_address( array $address_types ) { | |
$address_types['australia'] = array( | |
'label' => __( 'Australia', 'your-plugin-slug' ), //labels the dropdown | |
'country' => __( 'Australia', 'your-plugin-slug' ), //sets Australia as default country | |
'zip_label' => __( 'Post Code', 'your-plugin-slug' ), | |
'state_label' => __( 'State', 'your-plugin-slug' ), | |
'states' => array( | |
'', | |
__( 'Australian Capital Territory', 'your-plugin-slug' ), | |
__( 'New South Wales', 'your-plugin-slug' ), | |
__( 'Northern Territory', 'your-plugin-slug' ), | |
__( 'Queensland', 'your-plugin-slug' ), | |
__( 'South Australia', 'your-plugin-slug' ), | |
__( 'Tasmania', 'your-plugin-slug' ), | |
__( 'Victoria', 'your-plugin-slug' ), | |
__( 'Western Australia', 'your-plugin-slug' ), | |
), | |
); | |
return $address_types; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The slicker, tidier version of my older code with significant input from Gary Jones (kudos).