[Plugin: Polylang] Problems with pll_current_language
-
The past few days i have been trying to implement a PHP code to a theme that should display different logos depending on the language. For this i choose the pll_current_language from Polylang API.
This is how i am using it in the header.php:<?php if (pll_current_lang() === 'pt') { echo('/images/logo-pt.gif" width="508" height="145"'); } elseif (pll_current_lang() === 'en') { echo('/images/logo-en.gif" width="508" height="145"'); } elseif (pll_current_lang() === 'es') { echo('logo-es.gif" width="508" height="145"'); } else { echo('/images/logo-pt.gif'); } ?>
With this on the index.html comes out completely empty. If i cut it, the html comes out as it should.
Trying to get something more to understand what is happening i put a single line of PHP in the begining of the header.php so i could understand a bit more:
<!DOCTYPE HTML> <!-- <?php pll_current_language(); ?> --> <html lang="pt">
The result of this is:
<!DOCTYPE HTML> <!-- --> <html lang=pt>
My understanding from the documentation PDF is that i should get something like:
<!-- en -->
.I understand that i must be making some mistake but, even so, shouldn’t the PHP code fail at this point and go on with the rest of the thing?
For better understanding i am linking here The Good header.php and The Bad header.php.
- The topic ‘[Plugin: Polylang] Problems with pll_current_language’ is closed to new replies.