2

Wordpress Polylang plugin doesn't seem to translate my footer widgets. So I was thinking about creating separate footers for the different languages and calling the correct footer via a function in my child themes functions.php that checks the page language like so:

function switch_footer_language() {
    if(pll_current_language=='th') {
        get_footer('footer_th.php');

    } elseif(pll_current_language=='en') {
        get_footer('footer_en.php');
    }
}

Would this work? Would this be an appropriate way to do this? Is there a better way? And if so how?

Many Thanks.

Dayley
  • 166
  • 1
  • 2
  • 13
  • Never-mind. I found a better solution. Simply add multiple widgets in the footer area but only have them display if the page language is EN, TH etc. – Dayley Dec 05 '17 at 10:26
  • Can you elaborate on how you got this to work? I'm trying the same but the column count in the footer doesn't account for different language widgets not being shown. Perhaps a problem with the theme I'm using? – Pepijn Feb 10 '18 at 19:30
  • 2
    Sure, in the Wordpress Dashboard I went to Appearance > Widgets and created two widgets in each footer section instead of one Widget. You can then select a language at the bottom of the widget you wish the widget to display for if Polylang is enabled. For example: Write English text in one widget and and set the language to English, create another widget with Thai text (or whatever language) and set the language at the bottom to Thai. Its that simple! Of course you do have to create the languages in Polylang first. – Dayley Feb 12 '18 at 02:05
  • 1
    And then, if you need to add language-specific in the rest of the footer, use the PolyLang commands in the footer.php or equivalent. – eyal_katz May 25 '18 at 02:39

2 Answers2

1

Worked this out myself. Simply add multiple widgets in the footer area but only have them display if the page language is EN, TH, US etc.

In the Wordpress Dashboard I went to Appearance > Widgets and created two widgets in each footer section instead of one Widget. You can then select a language at the bottom of the widget you wish the widget to display for if Polylang is enabled. For example: Write English text in one widget and and set the language to English, create another widget with Thai text (or whatever language) and set the language at the bottom to Thai. Its that simple! Of course you do have to create the languages in Polylang first.

and as @eyal_katz mentioned, if you need to add language-specific in the rest of the footer, use the PolyLang commands in the footer.php or equivalent.

Dayley
  • 166
  • 1
  • 2
  • 13
0

You create different footers for different languages. They can be the same or with different widgets. You give them different names and you add the condition for the entire website ONLY to one of them. Then you link each one with the other footers in different languages, like you would do with every other page. Each time you change language the footer changes.