Martenzo
Martenzo

Reputation: 15

WordPress multilanguage text using code with PolyLang

I'm creating my multilanguage WordPress website using polylang plugin and Loco translate, but nothing happens with few lines. First "Product has been added to your cart", second is in checkout page "checkout" button,.

Maybe code exist with which I can replace this text In few languages?

I have in mind something like that

If ($lang = 'gb') {
Product has been added to your cart } else {
Other language text goes here }

Thanks for help.

Upvotes: 2

Views: 2013

Answers (1)

user8230352
user8230352

Reputation: 1783

I don't have much experience with polylang, but you could probably achieve this by using polylang pll_current_language() function, like this:

if (pll_current_language() == 'en') {
  echo "Product has been added to your cart";
} else if (pll_current_language() == 'de') {
  echo "Text in german";
}

Upvotes: 1

Related Questions