Skip to content

Instantly share code, notes, and snippets.

@GaryJones
Forked from thewebprincess/gravity-au.php
Last active April 27, 2016 15:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save GaryJones/8249902 to your computer and use it in GitHub Desktop.
Save GaryJones/8249902 to your computer and use it in GitHub Desktop.
Australian address format for Gravity Forms.
<?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