2

I have been using WPML for the use of multilingual but I am having major issues with it and am tired of it.

I have now set up two WordPress set ups on two different domains. What I need to do is create a button / way of having an if statement that will take the user to the exact page / post / product in the different language?

For example

I am on a post about cars in English the use will use the drop down to German and get the exact post but in German.

Now I know I have written any code yet but I am just the in the process and wanted to ask here first to see if anyone could point me in the right direction. Could this be done in PHP or Javascript / jquery etc?

Thanks for any help,

Max.

  • 3
    MultilingualPress does exactly that. Disclosure: I am the lead developer. – fuxia Apr 16 '15 at 9:06
  • Hey, ok could you point me in the right direct in creating a button please? Thanks! – Max Jacobs Apr 16 '15 at 9:07
  • Also does this work over two different domains? – Max Jacobs Apr 16 '15 at 9:08
  • It works in a multisite with different domains per site. MLP includes a widget and support for nav menus. You can also build your own language switcher. – fuxia Apr 16 '15 at 9:27
  • 1
    Multilingual means that content is available in more than one language. :) – fuxia Apr 16 '15 at 9:40
1

When a user creates a new page/post/product on one site, use the XML-RPC API to create a matching one on the other site. Make sure to save the ID of the original post under a meta key for the "duplicate" post, and then use the response ID from the API to save the "duplicate" ID under a meta key for the original.

You'll now have a post on each site with a reference to the other by ID, which will be enough to generate the "edit" link:

http://otherdomain.com/wp-admin/post.php?post=[ID]&action=edit

There are a few caveats worth bearing in mind - firstly, if a user deletes a post on one site, you lose the reference. It would be a good idea to hook onto the delete_post action and either:

  1. Prevent the user from doing so ("this post is a translated version and cannot be deleted")
  2. Use the XML-RPC API again to delete the reference from the other site.

Also, post authors. If you're using a shared database with custom user tables (which is what I would recommend), you only have to ensure they have the same capabilities on both sites.

However, if the users are also duplicates (separate installs), you'll need a similar cross-site reference (to know which author ID to use when creating the "other" post).

  • Thanks for this. I have been reading about domain mapping would work? – Max Jacobs Apr 16 '15 at 9:15
0

Clients are clients, but I suggest that you challenge those requirements. In the end of the day, after you have finished your work, the client is left alone to admin the site. Since for SEO reason the slugs of the posts in english and german will be different there is no trivial translation from one to the other, this means that if not for every url then for every public object in wordpress you will need a setting that helps you find the url in the other language. Depending on the amount of content changes the site will have and since updating the info is done by human it is likely to result in errors over time (did the SEO expert that renamed the slug remembered to update the relevant info on the other site?). Using XML-RPC as @TheDeadMedic suggests will solve big part of the problem, but it is not very trivial to implement (and you still need human interface if there is a bug in the sync process).

The realities of the internet is that most people are likely to get to the site in the language they search in, and therefor comfortable to use. For those rare few that get to the wrong one it should be enough to point to the general direction of the site in the other language.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.