Support » Plugins » [Plugin: Gengo] Different languages on different (sub-)domains

  • On my setup I want Gengo to use two domains, one for each language. I’ve written a quick plugin that does just that. It assumes you’re appending the language to the URL, that your languages have only two-letter codes, and that both domains point at the same website (this is sometimes called ‘mirroring’ or ‘parking’).

    Simply copy the code below into a file, and name it something like gengo-domains.php and place it in your plugins folder. You’ll need to change the language codes and URLs for your setup. Activate the plugin, and all links should now display for the correct domain.

    Plugin Name: Gengo support for domains
    Version: 0.1
    Plugin URI:
    Description: Adds domain support for Gengo.
    Author: Mark Barnes
    Author URI:
    function ru_retain_uri($content) {
    if (substr(trailingslashit($_SERVER['REQUEST_URI']),-4,4) == "/en/")
    return "";
    elseif (substr(trailingslashit($_SERVER['REQUEST_URI']),-4,4) == "/cy/")
    return "";
    return "http://".$_SERVER['SERVER_NAME'];
    function ru_page_link ($link) {
    $code = substr($link, -3, -1);
    if ($code=="en")
    return str_replace ("", "", $link);
    elseif ($code=="cy")
    return str_replace ("", "", $link);
    return $link;
    add_filter('option_home', 'ru_retain_uri', 1);
    add_filter('option_siteurl', 'ru_retain_uri', 1);
    add_filter('page_link', 'ru_page_link', 101);
  • The topic ‘[Plugin: Gengo] Different languages on different (sub-)domains’ is closed to new replies.