• We have a requirement to create 2 versions of a page. So 2 languages. But without using a translate function. The translations are already created, and need fed in through WordPress. So we are looking to create 2 versions of every page. The user then can toggle between each of the 2 languages. Without reloading the page. The URL will remain the same without any kind of filter or subdomain. The existing website already has this feature, but is not WordPress driven. Seems to use a span class for each language. Like below for example:

    <h2>
    <span class=”en”>English Title</span>
    <span class=”fr”>French Title</span>
    </h2>

    Any help greatly appreciated. Thanks.

    • This topic was modified 4 years, 8 months ago by Jan Dembowski.
Viewing 5 replies - 1 through 5 (of 5 total)
  • There are no real physical pages in wordpress. Everything is stored in a database and generated as needed. So your problem is to translate the data into different languages. I think you are looking for a plugin kind of like this one https://www.ads-software.com/plugins/weglot/.

    Thread Starter Blair Geddes

    (@primalspace)

    @mrtom414 thanks for your reply. But in this instance, that won’t work. We are not using a translation plugin, as the translations are already prepared by the client, and they want to feed them in themselves. So there needs to be 2 versions of each page, and editable from WP admin area. It’s a strange requirement I know. I don’t think there is a way to do it, but thought I’d post and ask and see if anyone had come across something similar in the past.

    Did you read this article?

    Multilingual WordPress

    Since you want the data to change when clicked and you don’t want to use a plugin to translate. You might look at create a custom post type containing both versions and using the REST API to switch on the fly between the 2 versions. You would have to also create custom fields to hold the different translations of the page. You could probably do it without using REST if you using custom fields and custom post types you simply toggle them on and off when clicked. It would make your pages rather large and probably slow to load. You could use jquery to toggle one on and the other one-off.

    you could probably also try sliding one translation on the screen and hiding the second one in using the CSS. In other words you one post would be pushed off the page and hidden with css overflow. For example, if you going left you would set one post to left:0 and the other to left:-600px. The left:-600px would be pushed off the screen to the left leaving the other post to be displayed. Anyway it would take a lot of work.

    • This reply was modified 4 years, 8 months ago by mrtom414.
    Thread Starter Blair Geddes

    (@primalspace)

    @willem0 thanks for your link. I think this could be a winner – https://www.ads-software.com/plugins/wpglobus/ Looks perfect.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to create 2 versions of all pages and posts on a site?’ is closed to new replies.