Anybody know the way how to load java script in the header-a of Wordpress as anyone came from one country and another java script when came from another country. Example: From US loads a java script in header.php, but if someone from UK visits the blog another java script loads in header.php. Excuse me for bad english. So this will be a geo targeting i mean.
Check out this Geo Targeting Plugin for Wordpress : http://wordpress.org/extend/plugins/gt-geo-targeting/
I'm kinda looking for the same thing. But for content instead. So that US visitors see another content than European visitors does etc.
You can determine country of the visitor by using this simple function: function GetUserCountry() { $ip = $_SERVER['REMOTE_ADDR']; $iptemp = explode('.', $ip); $ipdec = $iptemp[0] * 256 * 256 * 256 + $iptemp[1] * 256 * 256 + $iptemp[2] * 256 + $iptemp[3]; $file = file_get_contents('ips.txt'); if (!strlen($file)) return FALSE; $lines = explode("\n", $file); foreach($lines as $line) { if (strlen($line)) { $parts = explode(',', trim($line)); if ($ipdec >= $parts[0] && $ipdec <= $parts[1]) return $parts[2]; } } return FALSE; } Code (markup): You will have to download this zip file, extract the text file and put it in the same folder as the script. Here's a sample usage of the function: <?php if (GetUserCountry() == "United States") { ?> <b>Content for United States.</b> <?php } else { ?> <b>Content for other countries</b> <?php } ?> Code (markup): Hope it helps.