Forked from joshfeck/set_country_option_with_a_default.php
Last active
June 5, 2023 19:29
-
-
Save Pebblo/f6d51d80506130c1a5780f49b9cb3c14 to your computer and use it in GitHub Desktop.
Make the Country field default to US.
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 | |
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file | |
add_action( | |
'wp_enqueue_scripts', | |
'tw_ee_change_default_ee_country_and_state_option', | |
20 | |
); | |
function tw_ee_change_default_ee_country_and_state_option(){ | |
$custom_js = 'jQuery(document).ready(function($){'; | |
$custom_js .= '$(".ee-reg-qstn-country").val("US").trigger("change");'; | |
$custom_js .= '$(".ee-reg-qstn-state").val(17);'; // Illinois | |
$custom_js .= '});'; | |
wp_add_inline_script('ee_form_section_validation', $custom_js); | |
} |
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 | |
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file | |
add_action( | |
'wp_enqueue_scripts', | |
'tw_ee_change_default_ee_country_option', | |
20 | |
); | |
function tw_ee_change_default_ee_country_option(){ | |
$custom_js = 'jQuery(document).ready(function($){'; | |
$custom_js .= '$(".ee-reg-qstn-country").val("US").trigger("change");'; | |
$custom_js .= '});'; | |
wp_add_inline_script('ee_form_section_validation', $custom_js); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment