Forked from Shelob9/caldera_forms_phone_js_options-preferred.php
Created
March 19, 2018 14:45
-
-
Save BHWD/ed7d8b0d5a1490007ad3f2362c9c02d3 to your computer and use it in GitHub Desktop.
Change Caldera Forms phone field default country. See: https://calderaforms.com/doc/caldera_forms_phone_js_options/
This file contains hidden or 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 | |
/** | |
* Set preffered countries for Caldera Forms phone fields | |
*/ | |
add_filter( 'caldera_forms_phone_js_options', function( $options){ | |
//Use ISO_3166-1_alpha-2 formatted country code | |
$options[ 'preferredCountries' ] = array( 'MX' ); | |
return $options; | |
}); |
This file contains hidden or 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 | |
/** | |
* Set intiial country for Caldera Forms phone fields | |
*/ | |
add_filter( 'caldera_forms_phone_js_options', function( $options){ | |
//Use ISO_3166-1_alpha-2 formatted country code | |
$options[ 'initialCountry' ] = 'CH'; | |
return $options; | |
}); |
This file contains hidden or 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 | |
/** | |
* Show only specific countries' flag in Caldera Forms phone fields | |
*/ | |
add_filter( 'caldera_forms_phone_js_options', function($options ){ | |
$options[ 'onlyCountries' ] = array( 'cn', 'tw' ); | |
return $options; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment