L
L
Ludmila2018-05-29 18:14:51
WordPress
Ludmila, 2018-05-29 18:14:51

How to change header and footer when changing language using Polylang plugin in WordPress?

Good afternoon!
I am developing a site on Wordpress - the template is also my own with a developed design. The site must be in three languages ​​- Russian, English and Arabic. I am using the Polylang plugin.
It seems that everything turned out as we wanted, except for the header and footer . If it's not difficult, please tell me where to dig ..?
I beg you, do not push aside "go learn php". I teach, I try, I make mistakes, I correct them and I teach again...
But there are moments from which many have learned and also made mistakes. And I think they also asked for help ....
Thank you in advance for your help !!!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Yanchevsky, 2018-05-29
@Shadow_Princess

Kind.
It didn't work with the plugin, but judging by the documentation , it has the pll_current_language function to determine the current language. Therefore, add conditions to header.php and footer.php and change as needed.

if(pll_current_language() == 'ru') {
    //code
} else if(pll_current_language() == 'en') {
    //code
}

PS To see what and in what format the function returns, you can usevar_dump(pll_current_language());

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question