Map translation with WPML

This topic contains 2 replies, has 2 voices, and was last updated by  clem 8 years, 1 month ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #353691

    clem
    Buyer
    Post count: 87

    Hi !

    I’m using WPML for my website translation. For now I have 2 languages, English and French.

    I was wondering If there is a way to have the map in English In the English pages and in French in the French pages ?

    In the Geodirectory setup (design>map) we can only have 1 language for the whole site and in the WPML setup I have found nothing related to that …

    Thanks for your answer

    Clem

    #353792

    Kor
    Moderator
    Post count: 16516

    Hi Clem,

    I’ve just checked with a developer and you’d need some custom code to achieve what you needed there. Kindly insert the code below into your Website using the code snippets plugin and also change the languages below to suit your needs. Well, give it a try and let us know how it goes.

    
    
    // Change load add listing map language in current WPML language.
    function gd_wpml_default_map_language( $language ) {
        if ( defined( 'ICL_LANGUAGE_CODE' ) ) {
            $wpml_language = ICL_LANGUAGE_CODE;
            
            if ( $wpml_language == 'en' ) {
                 $language = 'en';
            } else if ( $wpml_language == 'fr' ) {
                 $language = 'fr';
            }
        }
    
        return $language;
    }
    add_filter( 'geodir_default_map_language', 'gd_wpml_default_map_language' );
    #354186

    clem
    Buyer
    Post count: 87

    Hi Kor !

    Thanks a lot ! works perfectly so far 🙂

Viewing 3 posts - 1 through 3 (of 3 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount