Another interesting challenge… PHP? Custom fields?

Hi,

Regarding http://fruit2.ca, I’d like to have the following functionality:

When clicking on the ‘SWITCH TO ENGLISH MODE’, it actually switches to the equivalent english page.

I’m guessing this could possibly be done with custom posts (maybe?), but not much experience working with them.

Thanks, any ideas would be much appreciated. :slight_smile:

  • drewc
    • Flash Drive

    HI Tom,

    Yes a multilingual site. The way I have it set up now is that clicking on the link takes you to either the French home page or the English home page.

    What I’d like is to have it switch to the same (corresponding/translated) English page if on French, and vice versa. Haven’t quite figured out how I would best accomplish this.

    Any help would be much appreciated – hope that helped to clarify.

    Thanks. :slight_smile:

  • Tom Eagles
    • Syntax Hero

    Hi again @drewc how have you translated the posts and pages? Depending on the method there are a few ways to attack this.

    Personally i have always used WPML for integrating a multilingual functionality into a wordpress site, it allows you to translate strings content etc etc and has an inbuilt language switcher. It even handles custom post types etc. And they work closely with us on things like marketpress etc.

    Different needs require different approaches esp with regards to making a seo optimised multilingual site. Its possible a bit tricky but well within reach i have a few tri lingual sites that are in the top 5 google rankings in all 3 languages plus their own domestic search engines.

    Cheers Tom

  • drewc
    • Flash Drive

    Hi, the person I’m working with is bilingual, so the separate French and English pages are already created. I’d like to just get the link to point to the right equivalent page if possible.

    One way I could think of doing it is hard-coding each link right into the page’s HTML in the WordPress HTML editing window, and relatively positioning it with CSS to move it up into roughly the same position now. Not very elegant though!

    Do you think there’s a proper way to do it, given the way the page is set up (i.e. already human-written translated separate pages)? I have not tried WPML, but I’ve spent a fair bit of time on this project already, and this is the last piece I need to complete it. A short bit of slick PHP code could potentially solve my problem after all!

    Could I give the two pages a matching, or otherwise “indicative” custom field, and then use PHP to find the matching custom field and make that the link? I’m not sure at all how that one would work… :slight_smile:

    Thanks for your help on this one.

  • Tom Eagles
    • Syntax Hero

    @drewc

    You could try something like this

    give each post page etc a language tag so for example en_page1 fr_page1

    then store that as a session variable for example $language and set ya links as something like sessionvariable_page1.

    Not the tidiest way to do it in wordpress but it should work. Anyway you choose now will need some custom work done to handle this.

    Cheers!

    Tom

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.