• Resolved TMNR

    (@tmnr)


    ***INFO***

    Twenty Eleven Child Theme
    No other plugins

    1. Permalink settings – default
    2. Static front page is used
    3. Settings:
    Detect browser language – N
    The language is set from content – Y
    Remove /language/ in pretty permalinks – Y
    Hide URL language information for default language – N
    When using static front page… – N
    Allow to synchronize categories – N

    I’ve read the documentation.

    ***Question***
    Hi,
    I have successfully set up 3 languages and it works fine with Displays a language switcher at the end of the menu option. But i want to add language chooser to my header. In documentation there’s a mention of pll_the_languages(); function and some examples, but i can’t seem to get it to work.

    I have created header.php in my child theme and tried to add one of the examples, but it breaks the site. What am i doing wrong? Am i missing something?

    https://www.ads-software.com/extend/plugins/polylang/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Chouby

    (@chouby)

    Thread Starter TMNR

    (@tmnr)

    I’ve read all available threads on this issue. Still can’t get it to run. Now tell me if i’m wrong, but to test this function i’ve tried to add
    <ul><?php pll_the_languages(); ?></ul> one of my pages content area in HTML mode (via WordPress dashboard). Also tried the same line in header.php, i mentioned previously – it breaks the CSS. Unfortunately no link ’cause i’m on a local dev server.

    Plugin Author Chouby

    (@chouby)

    Sorry. I did not understand first that only your CSS was broken. It’s quite logical it is as Twenty Eleven has not been designed with this modification in mind. However I can’t help if I don’t know where you put the code and the result you want to obtain.

    Thread Starter TMNR

    (@tmnr)

    As i said before – i want it to be in the header. So my first thought was to put the line in the header.php (notice that i’m using a child theme). So what are my options?

    Plugin Author Chouby

    (@chouby)

    Could you post your code? And tell me what is wrong in the result you obtain.

    Thread Starter TMNR

    (@tmnr)

    In a child theme folder i create a new file called header.php and i add <ul><?php pll_the_languages(); ?></ul> inside it. This supposed to add this line to the parent header.php file without compromising the original file, but i’m sure you know how child theme works.

    To say in other words – i have a stock twenty eleven theme (no modifications) and i want to add a language selector to my header. What do i do? Because my method described above does not work.

    Plugin Author Chouby

    (@chouby)

    Does your header.php in your child theme contain only this line?
    You must copy paste all the content of the original header.php in the file of your child theme and just add:
    <ul><?php pll_the_languages(); ?></ul>
    where you want it, for example after:
    </hgroup>
    (that would be pure luck that you want it here).

    Then you will need to add CSS rules to design it as you want.

    Thread Starter TMNR

    (@tmnr)

    It worked! I guess my main error was that i thought it would suffice to add only the line that i wanted. All i had to do is copy the whole content in to my child header.php. That’s me, always not paying enough attention to stuff. Thank you for your patience and happy Holidays!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Using pll_the_languages(); in Twenty Eleven child theme’ is closed to new replies.