Website regarding this: nedercraft.nl - nedercraft.com
QianQin could you help us out on having translation by TLD?
------------------------------------------------------------------------
Update: One step further, problem now.
As you can see on Nedercraft.com and Nedercraft.nl , headers and sidebars / widgets are translated perfectly as well as the other hardcoded translations in theme files.
But the content is not switched.
- Code: Select all
$x1 = ereg_replace("/(.+)", "", $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]);
$x2 = str_replace("www.", "", $x1);
$x3 = str_replace("/", "", $x2);
if ($x3 == "nedercraft.com" ) {
define('WP_SITEURL', 'http://www.nedercraft.com');
define('WP_HOME', 'http://www.nedercraft.com');
define('WPLANG', 'en_EN');
} else {
define('WP_SITEURL', 'http://www.nedercraft.nl');
define('WP_HOME', 'http://www.nedercraft.nl');
define('WPLANG', 'nl_NL');
}
define('WP_SITEURL', 'http://www.' . $x3);
define('WP_HOME', 'http://www.' . $x3);
Added this code into wp-config.php
- Code: Select all
<?php
$x4 = ereg_replace("/(.+)", "", $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]);
$x5 = str_replace("www.", "", $x4);
$x6 = str_replace("/", "", $x5);
if ($x6 == "nedercraft.com" ) {
$q_config['language'] = "en";
$q_config['default_language'] = "en";
} else {
$q_config['language'] = "nl";
$q_config['default_language'] = "nl";
}
?>
<?php get_header(); ?>
EDIT 2: Found the problem, add this code into functions.php in your theme file to set the language before anything else is loaded.
I now have to re do some part of my website to get this all working neatly. Ill report back with my used end codes.
