• I have a case, when I need to show a javascript code snipped depending on the website language.
    F.e. I have /de/ and /en/ added to the website URL, when language switches.
    I need one snippet loaded for de and another one for en.
    Is it possible?

    The language switch is implemented using plugin:
    WPML Multilingual CMS

    Maybe I can write a custom JS, that will observe URL change, and dynamiclaly insert another js src based on the language?
    Any other way?

    Best,
    Oleg

Viewing 1 replies (of 1 total)
  • This how we do it with WPML (this one was for a simple message):

    add_filter(‘woocommerce_thankyou_order_received_text’, ‘woo_change_order_received_text’, 10, 2 );
    function woo_change_order_received_text( $str, $order ) {
    if (ICL_LANGUAGE_CODE == ‘nl’)
    {
    $new_str = $str . ‘ Je ontvangt een orderbevestiging per e-mail. Controleer de spam-folder.’;
    } else if (ICL_LANGUAGE_CODE == ‘fr’)
    {
    $new_str = $str . ‘ Vous recevrez une confirmation de commande par e-mail. Vérifiez le dossier spam.’;
    }
    return $new_str;
    }

Viewing 1 replies (of 1 total)
  • The topic ‘Add code-snippet to footer per website language’ is closed to new replies.