Skip to content

Instantly share code, notes, and snippets.

@Barrytron1983
Created August 8, 2014 10:15
Show Gist options
  • Save Barrytron1983/48b553ddbd85e6aeae59 to your computer and use it in GitHub Desktop.
Save Barrytron1983/48b553ddbd85e6aeae59 to your computer and use it in GitHub Desktop.
Change element based on IP location :: Wordpress/JS
/* Header */
<script>
jQuery.getJSON('http://freegeoip.net/json/', function(location) {
if (location.country_code == 'GB') {
jQuery("#change_number").text("GB Tel: +44 2307055");
}
});
</script>
<script>
jQuery.getJSON('http://freegeoip.net/json/', function(location) {
if (location.country_code == 'IE') {
jQuery("#change_number").text("IE Tel: 021 2307055");
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment