Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pebblo/f6d51d80506130c1a5780f49b9cb3c14 to your computer and use it in GitHub Desktop.
Save Pebblo/f6d51d80506130c1a5780f49b9cb3c14 to your computer and use it in GitHub Desktop.
Make the Country field default to US.
<?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);
}
<?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