• Hey I am trying to make a if statement, which define the language which is been using in the website first, and then depends on the language, choosing the right content to show up.

    Here is the code

    [insert_php]$mylocale = get_bloginfo('language');if ($mylocale=="fr-FR"){[/insert_php]
            <div style="height:200px;width:570px;">Fr</div>[insert_php]}else{[/insert_php]
            <div style="height:200px;width:570px;">Eng</div>[insert_php] } [/insert_php]

    I am using “insert PHP to test the code inside a page, so i used [insert_php] instead of <?php ?>. But the problem is the if statement does not work.
    I used “echo $mylocale;” it works and shows correct value. but for the if statement, it always shows both of “Eng” and “Fr” without picking the right one.

    Anyone can help me please? Thank you

Viewing 1 replies (of 1 total)
  • Hi,

    Can you please write this line of code on that page and replay back with the output so I can check what the issue is.

    $mylocale = get_bloginfo('language');
    var_dump($mylocale);

    regards,
    Shreyans

Viewing 1 replies (of 1 total)
  • The topic ‘If statement does not working in WordPress’ is closed to new replies.