Forked from Shelob9/caldera_forms_phone_js_options-preferred.php
Created
September 17, 2018 01:22
-
-
Save techlab23/ca5fccb028c8c6536b058cdb00ae3155 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